home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / dynCreateLayout.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  86.6 KB  |  3,231 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  April, 1997
  22. //  Author:         Carol Levy
  23. //
  24. //  Description:
  25. //      This script contains code to create the layouts for the
  26. //        dynamics option boxes (for Dynamics menus).
  27. //
  28. //  Input Arguments to dynCreateLayout():
  29. //        string $parent  -- the layout parent
  30. //        int $theCmd -- the command for which the layout is being created
  31. //        int $isCreate -- create or add mode
  32. //
  33. //  Return Value:
  34. //      None.
  35. //
  36. global int $dynIsCreate;
  37. global string $__INST_OBJ_LIST_items[];
  38.  
  39.  
  40. global proc PIcreateDynamicMenuItem( string $list[], string $attrName, string $default )
  41. //
  42. // Description: 
  43. //
  44. // This proc creates the dynamic menus for the particle instancer for each of the 
  45. // instancer parameters (i.e. position, rotation, aim direction, etc).  The format
  46. // of the command it creates is a follows:
  47. //
  48. //    optionMenuGrp -l "Position"      "PositionOM";
  49. //    menuItem      -l "worldPosition" "PositionMenuItem1";
  50. //    menuItem      -l "worldVelocity" "PositionMenuItem2";
  51. //    ...
  52. //
  53. {
  54.     int    $index = 1;
  55.     string $miName;
  56.     string $omName = $attrName + "OM";
  57.  
  58.     optionMenuGrp -l $attrName -cc ("PIupdateDynamicAttributeOptionVar " + $attrName) $omName;
  59.  
  60.     // Make sure that all attributes have a "None" menu item except
  61.     // for "Position" which always needs to have a valid value.
  62.     //
  63.     if ( $attrName != "Position" ) 
  64.     {
  65.         $miName = $attrName + "MenuItem" + $index;
  66.  
  67.            menuItem -l "None" $miName;
  68.  
  69.         $index++;
  70.     }
  71.  
  72.     for ( $i = 0; $i < size( $list ); $i++ )
  73.     {
  74.         $miName = $attrName + "MenuItem" + $index;
  75.  
  76.         menuItem -l $list[$i] $miName;
  77.         $index++;
  78.     }
  79.  
  80.     // Select the default item.
  81.     //
  82.     optionMenuGrp -e -value $default $omName;
  83. }
  84.  
  85.  
  86. global proc dynCreateLayout(string $parent, 
  87.                                     string $theCmd, int $isCreate)
  88. {
  89.     global int $dynIsCreate;
  90.     
  91.     $dynIsCreate = $isCreate;
  92.  
  93.     string $procName = ("create"+$theCmd+"Layout");
  94.  
  95.     eval(($procName +" "+$parent));
  96. }
  97.  
  98. global proc createParticleRenderCacheLayout( string $parent )
  99.     text -align left -l " ";
  100.     text -align left -l "Once created, this cache will be used until you disable it.";
  101.     text -align left -l "See Solvers | Edit Oversampling and Cache.";
  102.     text -l " ";
  103.  
  104.     textFieldGrp -l "Cache Directory"
  105.         particleRenderCacheDirectory;
  106.  
  107.     //text -l " ";
  108.      text -align left -l "Directory is subdirectory of current project \"particles\" directory.";
  109.     text -l " ";
  110.  
  111.     checkBoxGrp -l "Use Render Globals Range" 
  112.         -ncb 1 -l1 ""
  113.         cacheForRenderGlobalsRange;
  114.     //text -l " ";
  115.     text -align left -l "If you check this item, Maya will cache for the current start/end";
  116.     text -align left -l "frames of the default render globals node. Otherwise, Maya will";
  117.     text -align left -l "use the current playback range.";
  118.     text -l " ";
  119.     text -align left -l "Maya will play the scene through the range being cached.";
  120.     text -align left -l "Hit ESC to interrupt the caching operation.";
  121.  
  122.     text -l " ";
  123.     checkBoxGrp -l "Only Update particles"
  124.         -ncb 1 -l1 ""
  125.         onlyUpdateParticles;
  126.     text -l " ";
  127. }
  128.  
  129.  
  130. global proc dynVolumeFieldShapeOptionChoice( string $parent, string $field )
  131. {
  132.     setParent $parent;
  133.  
  134.     int     $choice = `optionMenuGrp -q -sl ($field+"VolumeFieldTypesOM")`;
  135.  
  136.     // 
  137.     // None
  138.     // Note - first entry in this enum counts as 1, not 0.
  139.     if ($choice == 1)
  140.     {
  141.        // Disable all volume control attributes
  142.         if ($field != "volumeAxis")
  143.             checkBoxGrp -e -enable false ($field+"VolumeExclusion");
  144.  
  145.         floatSliderGrp -e -enable false ($field+"VolumeOffsetX");
  146.         floatSliderGrp -e -enable false ($field+"VolumeOffsetY");
  147.         floatSliderGrp -e -enable false ($field+"VolumeOffsetZ");
  148.         floatSliderGrp -e -enable false ($field+"VolumeSweep");
  149.         floatSliderGrp -e -enable false ($field+"TorusSectionRadius");
  150.  
  151.         if ($field == "volumeAxis")
  152.         {
  153.             floatSliderGrp -e -enable false ($field+"AlongAxis");
  154.             floatSliderGrp -e -enable false ($field+"AroundAxis");
  155.             floatSliderGrp -e -enable false ($field+"AwayFromAxis");
  156.             floatSliderGrp -e -enable false ($field+"AwayFromCenter");
  157.             //floatSliderGrp -e -enable false ($field+"RandomSpread");
  158.             floatSliderGrp -e -enable false ($field+"DirectionalSpeed");
  159.         }
  160.     }
  161.     else
  162.     {
  163.         if ($field != "volumeAxis")
  164.             checkBoxGrp -e -enable true ($field+"VolumeExclusion");
  165.  
  166.         floatSliderGrp -e -enable true ($field+"VolumeOffsetX");
  167.         floatSliderGrp -e -enable true ($field+"VolumeOffsetY");
  168.         floatSliderGrp -e -enable true ($field+"VolumeOffsetZ");
  169.         floatSliderGrp -e -enable true ($field+"VolumeSweep");
  170.         floatSliderGrp -e -enable false ($field+"TorusSectionRadius");
  171.  
  172.         if ($choice == 2)
  173.             floatSliderGrp -e -enable false ($field+"VolumeSweep");
  174.         else
  175.         if ($choice == 6)
  176.             floatSliderGrp -e -enable true ($field+"TorusSectionRadius");
  177.  
  178.         // Enable colume axis speeds according to type.
  179.         //
  180.         if ($field == "volumeAxis")
  181.         {
  182.             floatSliderGrp -e -enable true ($field+"AlongAxis");
  183.             floatSliderGrp -e -enable true ($field+"AroundAxis");
  184.             //floatSliderGrp -e -enable true ($field+"RandomSpread");
  185.             floatSliderGrp -e -enable true ($field+"DirectionalSpeed");
  186.  
  187.             if ($choice == 2 || $choice == 3)
  188.             {
  189.                 floatSliderGrp -e -enable false ($field+"AwayFromAxis");
  190.                 floatSliderGrp -e -enable true ($field+"AwayFromCenter");
  191.             }
  192.             else
  193.             {
  194.                 floatSliderGrp -e -enable true ($field+"AwayFromAxis");
  195.                 floatSliderGrp -e -enable false ($field+"AwayFromCenter");
  196.             }
  197.         }
  198.     }
  199. }
  200.  
  201.  
  202. proc createMaxDistanceControlLayout( string $parent, string $field )
  203. {
  204.     global float $dynMaxFloatField;
  205.     global float $dynMinFloatField;
  206.  
  207.     separator;
  208.  
  209.      checkBoxGrp -l "Use Max Distance" 
  210.         -ann "If false, field ignores max distance and extends without limit (subject to volume)"
  211.          -ncb 1 -l1 "" 
  212.          -on1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 1")
  213.          -of1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 0")
  214.          ($field+"MaxDistCBox");
  215.  
  216.      floatSliderGrp -label "Max Distance"
  217.         -ann "Maximum distance at which field has an effect (subject to volume)"
  218.         -field true
  219.         -min 0.0 -max 100.0
  220.         -fmn 0 -fmx $dynMaxFloatField
  221.         -pre 3-step 0.5
  222.         ($field+"MaxDistance");
  223. }
  224.  
  225. proc createMagAttControlLayout( string $parent, string $field )
  226. {
  227.     global float $dynMaxFloatField;
  228.     global float $dynMinFloatField;
  229.  
  230.     floatSliderGrp -label "Magnitude"
  231.         -ann "Strength of field force"
  232.         -field true
  233.         -min -100.0 -max 100.0
  234.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  235.         -pre 3 -step 0.5
  236.         ($field+"Magnitude");
  237.  
  238.     floatSliderGrp -label "Attenuation"
  239.         -ann "Makes field strength diminish with distance"
  240.         -field true
  241.         -min 0.0 -max 10.0
  242.         -fmn 0 -fmx $dynMaxFloatField
  243.         -pre 3 -step 0.5
  244.         ($field+"Attenuation");
  245. }
  246.  
  247. proc createVolumeFieldControlLayout( string $parent, string $field )
  248. {
  249.     global float $dynMaxFloatField;
  250.     global float $dynMinFloatField;
  251.  
  252.     separator;
  253.  
  254.     //text -align left -l "Volume Control Attributes" 
  255.     //    ($field+"VolumeText");
  256.  
  257.     // ATTENTION: to remove the help text from the field option boxes,
  258.     // comment out the following two lines.
  259.     //
  260.     text -align center -l "Volume determines the region where the field affects particles/rigid bodies.";
  261.  
  262.     optionMenuGrp -l "Volume Shape"
  263.         -ann "Determines (with max distance) where field affects objects. If None, only max distance is used."
  264.         -cc ("dynVolumeFieldShapeOptionChoice " + $parent + " " + $field)
  265.         ($field+"VolumeFieldTypesOM");
  266.     menuItem -l "None" ($field+"VolumeNone");
  267.     menuItem -l "Cube" ($field+"VolumeCube");
  268.     menuItem -l "Sphere" ($field+"VolumeSphere");
  269.     menuItem -l "Cylinder" ($field+"VolumeCylinder");
  270.     menuItem -l "Cone" ($field+"VolumeCone");
  271.     menuItem -l "Torus" ($field+"VolumeTorus");
  272.  
  273.     int $enabled = 0;
  274.  
  275.     if ($field != "volumeAxis")
  276.     {
  277.         checkBoxGrp -l "Volume Exclusion" 
  278.             -ann "Affect objects outside the volume instead of inside"
  279.             -enable $enabled
  280.             -ncb 1 -l1 "" 
  281.             ($field+"VolumeExclusion");
  282.     }
  283.  
  284.     floatSliderGrp -l "Volume Offset X"
  285.         -ann "Move volume away from actual field location"
  286.         -field true 
  287.         -enable $enabled
  288.         -min -10 -max 10
  289.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  290.         -pre 3 -step 0.1
  291.         ($field+"VolumeOffsetX");
  292.  
  293.     floatSliderGrp -l "Volume Offset Y"
  294.         -ann "Move volume away from actual field location"
  295.         -field true 
  296.         -enable $enabled
  297.         -min -10 -max 10
  298.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  299.         -pre 3 -step 0.1
  300.         ($field+"VolumeOffsetY");
  301.  
  302.     floatSliderGrp -l "Volume Offset Z"
  303.         -ann "Move volume away from actual field location"
  304.         -field true 
  305.         -enable $enabled
  306.         -min -10 -max 10
  307.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  308.         -pre 3 -step 0.1
  309.         ($field+"VolumeOffsetZ");
  310.  
  311.     floatSliderGrp -label "Volume Sweep"
  312.         -ann "Change extent of volume, as in modelling"
  313.         -field true 
  314.         -enable $enabled
  315.         -min 0 -max 360
  316.         //-fmn $dynMinFloatField -fmx $dynMaxFloatField
  317.         -pre 3 -step 3.6
  318.         ($field+"VolumeSweep");
  319.  
  320.     floatSliderGrp -label "Section Radius"
  321.         -ann "Change size of torus volume, as in modelling"
  322.         -field true 
  323.         -enable $enabled
  324.         -min 0 -max 1.0
  325.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  326.         -pre 3 -step 0.1
  327.         ($field+"TorusSectionRadius");
  328.  
  329.     // Make initial call to this routine to set up dimming.
  330.     // For the volume axis field we delay doing this until
  331.     // the main colume axis routine, when all the volume axis
  332.     // controls are set up.
  333.     //
  334.     if ($field != "volumeAxis")
  335.         dynVolumeFieldShapeOptionChoice( $parent, $field );
  336. }
  337.  
  338. global proc createAirLayout( string $parent )
  339. {
  340.     global float $dynMaxFloatField;
  341.     global float $dynMinFloatField;
  342.     global int $dynIsCreate;
  343.  
  344.     setParent $parent;
  345.     
  346.     // Name Widget
  347.     //
  348.     textFieldGrp -l "Air Field Name"
  349.         airName;
  350.  
  351.     separator;
  352.  
  353.     //text -align left -l "Predefined Settings"
  354.     //    airPresetsT;
  355.  
  356.     rowLayout
  357.         -cat 1 "both" 20
  358.         -cat 2 "both" 20
  359.         -cat 3 "both" 20
  360.         -cw 1 140
  361.         -cw 2 140
  362.         -cw 3 140
  363.         -cal 1 "left"
  364.         -nc 3
  365.         airPresetsRow;
  366.  
  367.     button -l "Wind" -al "center"
  368.         -ann "Set option values to simulate wind"
  369.         -c "dynAirPresetsCB 1"
  370.         airWind;
  371.     button -l "Wake" -al "center"
  372.         -ann "Set option values to simulate the wake of a moving object"
  373.         -c "dynAirPresetsCB 2"
  374.         airWake;
  375.     button -l "Fan" -al "center"
  376.         -ann "Set option values to simulate a fan"
  377.         -c "dynAirPresetsCB 3"
  378.         airFan;
  379.  
  380.     setParent ..;
  381.  
  382.     separator airSep2;
  383.  
  384.     // Attribute Widgets
  385.     //
  386.  
  387.     // Create our own widgets here because we want different help strings
  388.     //
  389.     string $field = "air";
  390.     floatSliderGrp -label "Magnitude"
  391.         -ann "Strength of air current. Particles will come to match this speed."
  392.         -field true
  393.         -min -100.0 -max 100.0
  394.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  395.         -pre 3 -step 0.5
  396.         ($field+"Magnitude");
  397.  
  398.     floatSliderGrp -label "Attenuation"
  399.         -ann "Makes magnitude diminish with distance"
  400.         -field true
  401.         -min 0.0 -max 10.0
  402.         -fmn 0 -fmx $dynMaxFloatField
  403.         -pre 3 -step 0.5
  404.         ($field+"Attenuation");
  405.  
  406.     string $dirAnnString = "Direction of the air flow";
  407.     floatSliderGrp -l "Direction X"
  408.         -ann  $dirAnnString
  409.         -field true 
  410.         -min -1 -max 1
  411.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  412.         -pre 3 -step 0.1
  413.         airDirectionX;
  414.  
  415.     floatSliderGrp -l "Direction Y"
  416.         -ann  $dirAnnString
  417.         -field true 
  418.         -min -1 -max 1
  419.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  420.         -pre 3 -step 0.1
  421.         airDirectionY;
  422.  
  423.     floatSliderGrp -l "Direction Z"
  424.         -ann  $dirAnnString
  425.         -field true 
  426.         -min -1 -max 1
  427.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  428.         -pre 3 -step 0.1
  429.         airDirectionZ;
  430.  
  431.     floatSliderGrp -l "Speed"
  432.         -ann "How fast particles come to match the speed of the air current"
  433.         -field true 
  434.         -min 0 -max 100
  435.         -fmn 0 -fmx $dynMaxFloatField
  436.         -pre 3 -step 1.0
  437.         airSpeed;
  438.  
  439.     floatSliderGrp -l "Inherit Velocity"
  440.         -ann "Amount of field's own velocity to add to the air flow"
  441.         -field true 
  442.         -min 0 -max 1
  443.         -fmn 0 -fmx $dynMaxFloatField
  444.         -pre 3 -step 0.1
  445.         airInheritVelocity;
  446.  
  447.     checkBoxGrp -l "Inherit Rotation" 
  448.         -ncb 1 -l1 ""
  449.         -ann "If true, and air field is rotating, air flow undergoes that same rotation"
  450.         airInheritRotation;
  451.  
  452.     checkBoxGrp -l "Component Only" 
  453.         -ann "If true, apply force only in the air flow direction"
  454.         -ncb 1 -l1 ""
  455.         airComponent;
  456.  
  457.     separator;
  458.  
  459.     //text  -align left -l "Spread" 
  460.     //    airSpreadText;
  461.  
  462.     checkBoxGrp -l "Enable Spread" 
  463.         -ann "Toggle spread on and off"
  464.         -ncb 1 -l1 ""
  465.         -on1 "dynAirEnableSpreadCB 1"
  466.         -of1 "dynAirEnableSpreadCB 0"
  467.         airEnableSpread;
  468.  
  469.     floatSliderGrp -l "Spread"
  470.         -ann "Angle from the direction setting within which objects are affected"
  471.         -field true
  472.         -min 0 -max 1
  473.         -pre 3 -step 0.1
  474.         airSpread;
  475.  
  476.     createMaxDistanceControlLayout( $parent, "air" );
  477.     createVolumeFieldControlLayout( $parent, "air" );
  478. }
  479.  
  480. global proc createDragLayout( string $parent )
  481. {
  482.     global float $dynMaxFloatField;
  483.     global float $dynMinFloatField;
  484.     global int $dynIsCreate;
  485.  
  486.     setParent $parent;
  487.     
  488.     // Drag Name Widget
  489.     //
  490.     textFieldGrp -l "Drag Field Name"
  491.         dragName;
  492.  
  493.     createMagAttControlLayout( $parent, "drag" );
  494.  
  495.     checkBoxGrp -l "Use Direction" 
  496.         -ann "Act only in a particular direction"
  497.         -ncb 1 -l1 "" 
  498.         dragUseDirection;
  499.  
  500.     string $dirAnnString = "Act in this direction";
  501.     floatSliderGrp -label "X Direction"
  502.         -ann $dirAnnString
  503.         -field true
  504.         -min -1.0 -max 1.0
  505.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  506.         -pre 3 -step 0.1
  507.         dragDirectionX;
  508.  
  509.     floatSliderGrp -label "Y Direction"
  510.         -ann $dirAnnString
  511.         -field true
  512.         -min -1.0 -max 1.0
  513.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  514.         -pre 3 -step 0.1
  515.         dragDirectionY;
  516.  
  517.      floatSliderGrp -label "Z Direction"
  518.         -ann $dirAnnString
  519.         -field true
  520.         -min -1.0 -max 1.0
  521.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  522.         -pre 3 -step 0.1
  523.         dragDirectionZ;
  524.  
  525.     createMaxDistanceControlLayout( $parent, "drag" );
  526.     createVolumeFieldControlLayout( $parent, "drag" );
  527. }
  528.  
  529.  
  530. global proc createGravityLayout( string $parent )
  531. {
  532.     global float $dynMaxFloatField;
  533.     global float $dynMinFloatField;
  534.     global int $dynIsCreate;
  535.  
  536.     setParent $parent;
  537.     
  538.     // Name Widget
  539.     //
  540.     textFieldGrp -l "Gravity Field Name"
  541.         gravityName;
  542.  
  543.     createMagAttControlLayout( $parent, "gravity" );
  544.  
  545.     string $dirAnnString = "Make objects fall in this direction";
  546.     floatSliderGrp -label "X Direction"
  547.         -ann $dirAnnString
  548.         -field true
  549.         -min -1.0 -max 1.0
  550.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  551.         -pre 3 -step 0.1
  552.         gravityDirectionX;
  553.  
  554.     floatSliderGrp -label "Y Direction"
  555.         -ann $dirAnnString
  556.         -field true
  557.         -min -1.0 -max 1.0
  558.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  559.         -pre 3 -step 0.1
  560.         gravityDirectionY;
  561.  
  562.      floatSliderGrp -label "Z Direction"
  563.         -ann $dirAnnString
  564.         -field true
  565.         -min -1.0 -max 1.0
  566.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  567.         -pre 3 -step 0.1
  568.         gravityDirectionZ;
  569.  
  570.     createMaxDistanceControlLayout( $parent, "gravity" );
  571.     createVolumeFieldControlLayout( $parent, "gravity" );
  572.  
  573. }
  574.  
  575. global proc createNewtonLayout( string $parent )
  576. {
  577.     global float $dynMaxFloatField;
  578.     global float $dynMinFloatField;
  579.     global int $dynIsCreate;
  580.  
  581.     setParent $parent;
  582.     
  583.     // Name Widget
  584.     //
  585.     textFieldGrp -l "Newton Field Name"
  586.         newtonName;
  587.  
  588.     createMagAttControlLayout( $parent, "newton" );
  589.  
  590.     floatSliderGrp -l "Min Distance"
  591.         -ann "Field will not act inside this distance. Use this to avoid wild motion for objects very near field location."
  592.         -field true
  593.         -min 0 -max 100
  594.         -fmn 0 -fmx $dynMaxFloatField
  595.         -pre 3-step 0.5
  596.         newtonMinDistance;
  597.  
  598.     createMaxDistanceControlLayout( $parent, "newton" );
  599.     createVolumeFieldControlLayout( $parent, "newton" );
  600. }
  601.  
  602. global proc createRadialLayout( string $parent )
  603. {
  604.     global float $dynMaxFloatField;
  605.     global float $dynMinFloatField;
  606.     global int $dynIsCreate;
  607.  
  608.     setParent $parent;
  609.     
  610.     // Name Widget
  611.     //
  612.     textFieldGrp -l "Radial Field Name"
  613.         radialName;
  614.  
  615.     createMagAttControlLayout( $parent, "radial" );
  616.  
  617.     floatSliderGrp -label "Radial Type"
  618.         -ann "If 0, attenuation will decrease magnitude smoothly to 0 at max distance"
  619.         -field true
  620.         -min 0.0 -max 1.0
  621.         radialType;
  622.  
  623.     createMaxDistanceControlLayout( $parent, "radial" );
  624.     createVolumeFieldControlLayout( $parent, "radial" );
  625. }
  626.  
  627. global proc createTurbulenceLayout( string $parent )
  628. {
  629.     global float $dynMaxFloatField;
  630.     global float $dynMinFloatField;
  631.     global int $dynIsCreate;
  632.  
  633.     setParent $parent;
  634.     
  635.     // Name Widget
  636.     //
  637.     textFieldGrp -l "Turbulence Field Name"
  638.         turbulenceName;
  639.  
  640.     createMagAttControlLayout( $parent, "turbulence" );
  641.  
  642.     floatSliderGrp -label "Frequency"
  643.         -ann "Greater value causes more frequent irregularities in the motion"
  644.         -field true
  645.         -min 0.0 -max 100.0
  646.         -fmn 0 -fmx $dynMaxFloatField
  647.         -pre 3-step 0.5
  648.         turbulenceFrequency;
  649.  
  650.     floatSliderGrp -label "Phase X"
  651.         -ann "Influences disruption along the x axis"
  652.         -field true
  653.         -min -50.0 -max 50.0
  654.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  655.         -pre 3-step 0.5
  656.         turbulencePhaseX;
  657.  
  658.     floatSliderGrp -label "Phase Y"
  659.         -ann "Influences disruption along the y axis"
  660.         -field true
  661.         -min -50.0 -max 50.0
  662.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  663.         -pre 3-step 0.5
  664.         turbulencePhaseY;
  665.  
  666.     floatSliderGrp -label "Phase Z"
  667.         -ann "Influences disruption along the z axis"
  668.         -field true
  669.         -min -50.0 -max 50.0
  670.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  671.         -pre 3 -step 0.5
  672.         turbulencePhaseZ;
  673.  
  674.     intSliderGrp -label "Noise Level"
  675.         -ann "Determines number of noise lookups, and thus the amount of irregularity"
  676.         -field true
  677.         -min 0 -max 50
  678.         -fmx $dynMaxFloatField
  679.         //-pre 3 -step 1.0
  680.         turbulenceNoiseLevel;
  681.  
  682.     floatSliderGrp -label "Noise Ratio"
  683.         -ann "Determines weighting of successive noise lookups"
  684.         -field true
  685.         -min -1.0 -max 1.0
  686.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  687.         -pre 3 -step 0.1
  688.         turbulenceNoiseRatio;
  689.  
  690.     createMaxDistanceControlLayout( $parent, "turbulence" );
  691.     createVolumeFieldControlLayout( $parent, "turbulence" );
  692. }
  693.  
  694. global proc createUniformLayout( string $parent )
  695. {
  696.     global float $dynMaxFloatField;
  697.     global float $dynMinFloatField;
  698.     global int $dynIsCreate;
  699.  
  700.     setParent $parent;
  701.     
  702.     // Name Widget
  703.     //
  704.     textFieldGrp -l "Uniform Field Name"
  705.         uniformName;
  706.  
  707.     createMagAttControlLayout( $parent, "uniform" );
  708.  
  709.     string $dirAnnString = "Make objects move in this direction";
  710.  
  711.     floatSliderGrp -label "Direction X"
  712.         -ann $dirAnnString
  713.         -field true
  714.         -min -1.0 -max 1.0
  715.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  716.         -pre 3 -step 0.1
  717.         uniformDirectionX;
  718.  
  719.     floatSliderGrp -label "Direction Y"
  720.         -ann $dirAnnString
  721.         -field true
  722.         -min -1.0 -max 1.0
  723.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  724.         -pre 3 -step 0.1
  725.         uniformDirectionY;
  726.  
  727.     floatSliderGrp -label "Direction Z"
  728.         -ann $dirAnnString
  729.         -field true
  730.         -min -1.0 -max 1.0
  731.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  732.         -pre 3 -step 0.1
  733.         uniformDirectionZ;
  734.  
  735.     createMaxDistanceControlLayout( $parent, "uniform" );
  736.     createVolumeFieldControlLayout( $parent, "uniform" );
  737.  
  738. }
  739.  
  740. global proc createVortexLayout( string $parent )
  741. {
  742.     global float $dynMaxFloatField;
  743.     global float $dynMinFloatField;
  744.     global int $dynIsCreate;
  745.  
  746.     setParent $parent;
  747.     
  748.     // Name Widget
  749.     //
  750.     textFieldGrp -l "Vortex Field Name"
  751.         vortexName;
  752.  
  753.     createMagAttControlLayout( $parent, "vortex" );
  754.  
  755.     string $axisAnnString = "Make objects revolve around this axis";
  756.     floatSliderGrp -label "Axis X"
  757.         -ann $axisAnnString
  758.         -field true
  759.         -min -1.0 -max 1.0
  760.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  761.         -pre 3 -step 0.1
  762.         vortexAxisX;
  763.  
  764.     floatSliderGrp -label "Axis Y"
  765.         -ann $axisAnnString
  766.         -field true
  767.         -min -1.0 -max 1.0
  768.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  769.         -pre 3 -step 0.1
  770.         vortexAxisY;
  771.  
  772.     floatSliderGrp -label "Axis Z"
  773.         -ann $axisAnnString
  774.         -field true
  775.         -min -1.0 -max 1.0
  776.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  777.         -pre 3 -step 0.1
  778.         vortexAxisZ;
  779.  
  780.     separator;
  781.  
  782.     createMaxDistanceControlLayout( $parent, "vortex" );
  783.     createVolumeFieldControlLayout( $parent, "vortex" );
  784.  
  785. }
  786.  
  787.  
  788. global proc createVolumeAxisLayout( string $parent )
  789. {
  790.     global float $dynMaxFloatField;
  791.     global float $dynMinFloatField;
  792.     global int $dynIsCreate;
  793.  
  794.     setParent $parent;
  795.     
  796.     // Name Widget
  797.     //
  798.     textFieldGrp -l "Volume Axis Field Name"
  799.         volumeAxisName;
  800.  
  801.     createMagAttControlLayout( $parent, "volumeAxis" );
  802.  
  803.     createMaxDistanceControlLayout( $parent, "volumeAxis" );
  804.     createVolumeFieldControlLayout( $parent, "volumeAxis" );
  805.  
  806.     separator;
  807.  
  808.      checkBoxGrp -l "Invert Attenuation" 
  809.         -ann "If true and attenuation is greater than 0.0, field effect increases with distance."
  810.          -ncb 1 -l1 "" 
  811.         -enable 1
  812.          volumeAxisInvertAttenuation;
  813.  
  814.     floatSliderGrp -label "Away From Center"
  815.         -ann "Make particles move directly away from volume center point"
  816.         -field true 
  817.         -min -10 -max 10
  818.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  819.         -pre 3 -step 0.5
  820.         volumeAxisAwayFromCenter;
  821.  
  822.     floatSliderGrp -label "Away From Axis"
  823.         -ann "Make particles move directly away from volume axis"
  824.         -field true 
  825.         -min -10 -max 10
  826.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  827.         -pre 3 -step 0.5
  828.         volumeAxisAwayFromAxis;
  829.  
  830.     floatSliderGrp -label "Along Axis"
  831.         -ann "Make particles move along volume axis"
  832.         -field true 
  833.         -min -10 -max 10
  834.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  835.         -pre 3 -step 0.5
  836.         volumeAxisAlongAxis;
  837.  
  838.     floatSliderGrp -label "Around Axis"
  839.         -ann "Make particles rotate around volume axis"
  840.         -field true 
  841.         -min -10 -max 10
  842.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  843.         -pre 3 -step 0.5
  844.         volumeAxisAroundAxis;
  845.  
  846.     //floatSliderGrp -label "Random Direction"
  847.     //    -ann "Adds to particle motion a component of this length in random direction"
  848.     //    -field true 
  849.     //   -min -10 -max 10
  850.     //    -fmn $dynMinFloatField -fmx $dynMaxFloatField
  851.     //    -pre 3 -step 0.5
  852.     //    volumeAxisRandomSpread;
  853.  
  854.     floatSliderGrp -label "Directional Speed"
  855.         -ann "Adds to particle motion a component of this length in directionX/Y/Z"
  856.         -field true 
  857.         -min -10 -max 10
  858.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  859.         -pre 3 -step 0.5
  860.         volumeAxisDirectionalSpeed;
  861.  
  862.     floatSliderGrp -label "DirectionX"
  863.         -ann "Push particles in this direction"
  864.         -field true 
  865.         -min -10 -max 10
  866.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  867.         -pre 3 -step 0.5
  868.         volumeAxisDirectionX;
  869.  
  870.     floatSliderGrp -label "DirectionY"
  871.         -ann "Emit particles in this direction"
  872.         -field true 
  873.         -min -10 -max 10
  874.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  875.         -pre 3 -step 0.5
  876.         volumeAxisDirectionY;
  877.  
  878.     floatSliderGrp -label "DirectionZ"
  879.         -ann "Emit particles in this direction"
  880.         -field true 
  881.         -min -10 -max 10
  882.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  883.         -pre 3 -step 0.5
  884.         volumeAxisDirectionZ;
  885.  
  886.     floatSliderGrp -label "Turbulence"
  887.         -ann "Simulate an animated turbulent wind field"
  888.         -field true 
  889.         -min 0 -max 10
  890.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  891.         -pre 3 -step 0.5
  892.         volumeAxisTurbulence;
  893.  
  894.     floatSliderGrp -label "Turbulence Speed"
  895.         -ann "Rate of change of turbulence over time."
  896.         -field true 
  897.         -min 0 -max 1
  898.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  899.         -pre 3 -step 0.5
  900.         volumeAxisTurbulenceSpeed;
  901.  
  902.     floatSliderGrp -label "Turbulence Frequency X"
  903.         -ann "Repeats in X of turbulence function"
  904.         -field true 
  905.         -min 0 -max 10
  906.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  907.         -pre 3 -step 0.5
  908.         volumeAxisTurbulenceFrequencyX;
  909.  
  910.     floatSliderGrp -label "Turbulence Frequency Y"
  911.         -ann "Repeats in Y of turbulence function"
  912.         -field true 
  913.         -min 0 -max 10
  914.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  915.         -pre 3 -step 0.5
  916.         volumeAxisTurbulenceFrequencyY;
  917.  
  918.     floatSliderGrp -label "Turbulence Frequency Z"
  919.         -ann "Repeats in Z of turbulence function"
  920.         -field true 
  921.         -min 0 -max 10
  922.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  923.         -pre 3 -step 0.5
  924.         volumeAxisTurbulenceFrequencyZ;
  925.  
  926.     floatSliderGrp -label "Turbulence Offset X"
  927.         -ann "Translation in X of turbulence function"
  928.         -field true 
  929.         -min -10 -max 10
  930.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  931.         -pre 3 -step 0.5
  932.         volumeAxisTurbulenceOffsetX;
  933.  
  934.     floatSliderGrp -label "Turbulence Offset Y"
  935.         -ann "Translation in Y of turbulence function"
  936.         -field true 
  937.         -min -10 -max 10
  938.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  939.         -pre 3 -step 0.5
  940.         volumeAxisTurbulenceOffsetY;
  941.  
  942.     floatSliderGrp -label "Turbulence Offset Z"
  943.         -ann "Translation in Z of turbulence function"
  944.         -field true 
  945.         -min -10 -max 10
  946.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  947.         -pre 3 -step 0.5
  948.         volumeAxisTurbulenceOffsetZ;
  949.  
  950.     floatSliderGrp -label "Detail Turbulence"
  951.         -ann "The relative intensity of a second higher frequency turbulence."
  952.         -field true 
  953.         -min 0 -max 1
  954.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  955.         -pre 3 -step 0.5
  956.         volumeAxisDetailTurbulence;
  957.  
  958.  
  959.     // initialize the dimming
  960.     //
  961.     dynVolumeFieldShapeOptionChoice( $parent, "volumeAxis" );
  962. }
  963.  
  964. global proc createEmitterLayout( string $parent )
  965. {
  966.     global float $dynMaxFloatField;
  967.     global float $dynMinFloatField;
  968.     global int $dynIsCreate;
  969.  
  970.     setParent $parent;
  971.     
  972.     // Emitter Name Widget
  973.     //
  974.     textFieldGrp -l "Emitter Name"
  975.         emitterName;
  976.  
  977.     // Basic Emitter Attributes Layout
  978.     //
  979.     frameLayout -l "Basic Emitter Attributes"
  980.         -bv true -lv true -cll true -cl false -mh 4
  981.         emitterBasicFL;
  982.     columnLayout emitterBasicCL;
  983.  
  984.     // Emitter Types Option Menu
  985.     // 
  986.     optionMenuGrp -l "Emitter Type"
  987.         -cc ("dynEmitterOptionChoice " + $parent)
  988.         emitterTypesOM;
  989.     menuItem -l "Omni" emitterOmniPoint;
  990.     menuItem -l "Directional" emitterDirPoint;
  991.  
  992.     if (!$dynIsCreate)
  993.     {
  994.         menuItem -l "Surface" emitterSurface;
  995.         menuItem -l "Curve" emitterCurve;
  996.  
  997.         // If user is switching to add emitter, and previously
  998.         // the user had set the emitterTypesOM to 5 (volume),
  999.         // then it must be set to something valid, so set to omni.
  1000.         //
  1001.         if (`optionVar -exists emitterTypesOM`  && 
  1002.             (`optionVar -query emitterTypesOM` == 5))
  1003.         {
  1004.             optionVar -intValue emitterTypesOM 1;
  1005.         }
  1006.     }
  1007.     else
  1008.     {
  1009.         menuItem -l "Volume" emitterVolume;
  1010.  
  1011.         // If user is switching to create emitter, and previously
  1012.         // the user had set the emitterTypesOM to 3 (surface) or
  1013.         // 4 (curve) in
  1014.         // add emitter mode, then it must be reset to something
  1015.         // valid, so set it to omni.
  1016.         //
  1017.         if (`optionVar -exists emitterTypesOM`  && 
  1018.             ((`optionVar -query emitterTypesOM` == 3) ||
  1019.              (`optionVar -query emitterTypesOM` == 4)))
  1020.         {
  1021.             optionVar -intValue emitterTypesOM 1;
  1022.         }
  1023.     }
  1024.  
  1025.     floatSliderGrp -l "Rate (Particles/Sec)"
  1026.         -ann "Number of particles to create per second"
  1027.         -field true 
  1028.         -min 0 -max 500
  1029.         -fmn 0 -fmx $dynMaxFloatField
  1030.         -pre 3 -step 10
  1031.         emitterRate;
  1032.  
  1033.     checkBoxGrp -l "Scale Rate By Object Size" 
  1034.         -ann "If false, scaling object doesn't change number of particles emitted"
  1035.         -ncb 1 -l1 "" 
  1036.         emitterScaleRateByObjectSize;
  1037.  
  1038.     checkBoxGrp -l "Need Parent UV (NURBS)" 
  1039.         -ann "Record parent (u,v) data. Must also add parentU/parentV to particle shape. NURBS surfaces only."
  1040.         -ncb 1 -l1 "" 
  1041.         emitterNeedParentUV;
  1042.  
  1043.     optionMenuGrp -l "Cycle Emission"
  1044.         -ann "Restart random stream for this emitter each frame or after some number of particles"
  1045.         -cc ("dynEmitterCycleOptionChoice " + $parent)
  1046.        emitterCycleOM;
  1047.     menuItem -l "None (timeRandom off)" emitterCycleNone;
  1048.     menuItem -l "Frame (timeRandom on)" emitterCycleFrame;
  1049.     // menuItem -l "By Particle Count" emitterCycleCount;
  1050.  
  1051.     intSliderGrp -l "Cycle Interval"
  1052.         -ann "Number of frames/particles between restarts of random stream"
  1053.         -field true 
  1054.         -min 1 -max 100
  1055.         -fmx $dynMaxFloatField
  1056.         //-pre 3 -step 0.5
  1057.         emitterCycleInterval;
  1058.  
  1059.     setParent ..; 
  1060.     setParent ..; 
  1061.  
  1062.  
  1063.     // Direction Layout
  1064.     //
  1065.     frameLayout -l "Distance/Direction Attributes"
  1066.         -bv true -lv true -cll true -cl true -mh 4
  1067.         emitterDirectionFL;
  1068.     columnLayout emitterDirectionCL;
  1069.  
  1070.     floatSliderGrp -l "Max Distance"
  1071.         -ann "Emit particles in a sphere bounded by this distance (does not apply to volumes)"
  1072.         -field true 
  1073.         -min 0 -max 10
  1074.         -fmn 0 -fmx $dynMaxFloatField
  1075.         -pre 3 -step 0.5
  1076.         -cc emitterMaxDistCB
  1077.         emitterMaxDistance;
  1078.  
  1079.     floatSliderGrp -l "Min Distance"
  1080.         -ann "Emit particles in a sphere bounded by this distance (does not apply to volumes)"
  1081.         -field true 
  1082.         -min 0 -max 10
  1083.         -fmn 0 -fmx $dynMaxFloatField
  1084.         -pre 3 -step 0.5
  1085.         -cc emitterMinDistCB
  1086.         emitterMinDistance;
  1087.  
  1088.     floatSliderGrp -label "DirectionX"
  1089.         -ann "Emit particles in this direction"
  1090.         -field true 
  1091.         -min -10 -max 10
  1092.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1093.         -pre 3 -step 0.5
  1094.         emitterDirectionX;
  1095.  
  1096.     floatSliderGrp -label "DirectionY"
  1097.         -ann "Emit particles in this direction"
  1098.         -field true 
  1099.         -min -10 -max 10
  1100.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1101.         -pre 3 -step 0.5
  1102.         emitterDirectionY;
  1103.  
  1104.     floatSliderGrp -label "DirectionZ"
  1105.         -ann "Emit particles in this direction"
  1106.         -field true 
  1107.         -min -10 -max 10
  1108.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1109.         -pre 3 -step 0.5
  1110.         emitterDirectionZ;
  1111.  
  1112.     floatSliderGrp -l "Spread"
  1113.         -ann "Randomize the directions of particles"
  1114.         -field true 
  1115.         -min 0 -max 1
  1116.         -pre 3 -step 0.1
  1117.         emitterSpread;
  1118.  
  1119.     setParent ..;
  1120.     setParent ..;
  1121.  
  1122.     // Basic Emission Speed
  1123.     //
  1124.     frameLayout -l "Basic Emission Speed Attributes"
  1125.         -bv true -lv true -cll true -cl false -mh 4
  1126.         emitterSpeedFL;
  1127.     columnLayout emitterSpeedCL;
  1128.  
  1129.     floatSliderGrp -l "Speed"
  1130.         -ann "Make particles move faster. Does not apply to volume emitters"
  1131.         -field true
  1132.         -min 0 -max 10
  1133.         -fmn 0 -fmx $dynMaxFloatField
  1134.         -pre 3 -step 0.1
  1135.         emitterSpeed;
  1136.  
  1137.     floatSliderGrp -l "Speed Random"
  1138.         -ann "Randomize the speeds of particles up to plus or minus one-half this value"
  1139.         -field true
  1140.         -min 0 -max 10
  1141.         -fmn 0 -fmx $dynMaxFloatField
  1142.         -pre 3 -step 0.1
  1143.         emitterSpeedRandomRange;
  1144.  
  1145.     floatSliderGrp -l "Tangent Speed"
  1146.         -ann "Makes particles move randomly along curve or surface"
  1147.         -field true
  1148.         -min 0 -max 10
  1149.         -fmn 0 -fmx $dynMaxFloatField
  1150.         -pre 3 -step 0.1
  1151.         emitterTangentSpeed;
  1152.  
  1153.     floatSliderGrp -l "Normal Speed"
  1154.         -ann "Makes particles move directly away from curve or surface"
  1155.         -field true
  1156.         -min 0 -max 10
  1157.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1158.         -pre 3 -step 0.1
  1159.         emitterNormalSpeed;
  1160.  
  1161.     setParent ..; 
  1162.     setParent ..; 
  1163.  
  1164.     // Volume Emitter Attributes Layout
  1165.     //
  1166.     int $collapse = 0;
  1167.  
  1168.     frameLayout -l "Volume Emitter Attributes"
  1169.         -bv true -lv true -cll true -cl $collapse -mh 4
  1170.         emitterVolumeFL;
  1171.     columnLayout emitterVolumeCL;
  1172.  
  1173.     text -align left -l "Set emitter type to Volume to enable" emitterVolumeEnablePrompt;
  1174.  
  1175.     optionMenuGrp -l "Volume Shape"
  1176.         -ann "Determines where particles are created (for volume type emitter, only)"
  1177.         -cc ("setDimmingForVolumeEmitterAttributes " + $parent)
  1178.         emitterVolumeShapeOM;
  1179.     menuItem -l "Cube" emitterCube;
  1180.     menuItem -l "Sphere" emitterSphere;
  1181.     menuItem -l "Cylinder" emitterCylinder;
  1182.     menuItem -l "Cone" emitterCone;
  1183.     menuItem -l "Torus" emitterTorus;
  1184.  
  1185.     floatSliderGrp -label "Volume Offset X"
  1186.         -ann "Move volume away from actual emitter location"
  1187.         -field true 
  1188.         -min -10 -max 10
  1189.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1190.         -pre 3 -step 0.5
  1191.         emitterVolumeOffsetX;
  1192.  
  1193.     floatSliderGrp -label "Volume Offset Y"
  1194.         -ann "Move volume away from actual emitter location"
  1195.         -field true 
  1196.         -min -10 -max 10
  1197.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1198.         -pre 3 -step 0.5
  1199.         emitterVolumeOffsetY;
  1200.  
  1201.     floatSliderGrp -label "Volume Offset Z"
  1202.         -ann "Move volume away from actual emitter location"
  1203.         -field true 
  1204.         -min -10 -max 10
  1205.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1206.         -pre 3 -step 0.5
  1207.         emitterVolumeOffsetZ;
  1208.  
  1209.     floatSliderGrp -label "Volume Sweep"
  1210.         -ann "Change extent of volume, as in modelling"
  1211.         -field true 
  1212.         -min 0 -max 360
  1213.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1214.         -pre 3 -step 3.6
  1215.         emitterVolumeSweep;
  1216.  
  1217.     floatSliderGrp -label "Section Radius"
  1218.         -ann "Change size of torus volume, as in modelling"
  1219.         -field true 
  1220.         -min 0 -max 1.0
  1221.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1222.         -pre 3 -step 0.1
  1223.         emitterTorusSectionRadius;
  1224.  
  1225.     string $os = `about -os`;
  1226.     if ($os == "irix") {
  1227.         // On Irix, the text of the label does not fit without reformatting
  1228.         // so give it a slightly nonstandard layout.
  1229.         //
  1230.         checkBoxGrp -l "Die on Emission Volume Exit"
  1231.             -cw2 175 200
  1232.             -ncb 1 -l1 "" 
  1233.             emitterDieOnExit;
  1234.     } else {
  1235.         checkBoxGrp -l "Die on Emission Volume Exit"
  1236.             -ncb 1 -l1 "" 
  1237.             emitterDieOnExit;
  1238.     }
  1239.  
  1240.     checkBoxGrp -e -ann "If true, particles die on exiting volume. After creating emitter, this attribute can be found in the particle's attribute editor under Emission Attributes."
  1241.         emitterDieOnExit;
  1242.     
  1243.     setParent ..; 
  1244.     setParent ..; 
  1245.  
  1246.  
  1247.     // Volume Speed Attributes Layout
  1248.     //
  1249.     frameLayout -l "Volume Speed Attributes"
  1250.         -bv true -lv true -cll true -cl $collapse -mh 4
  1251.         emitterVolumeSpeedFL;
  1252.     columnLayout emitterVolumeSpeedCL;
  1253.  
  1254.     text -align left -l "Set emitter type to Volume to enable" emitterVolumeSpeedEnablePrompt;
  1255.  
  1256.     floatSliderGrp -label "Away From Center"
  1257.         -ann "Make particles move directly away from volume center point"
  1258.         -field true 
  1259.         -min -10 -max 10
  1260.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1261.         -pre 3 -step 0.5
  1262.         emitterAwayFromCenter;
  1263.  
  1264.     floatSliderGrp -label "Away From Axis"
  1265.         -ann "Make particles move directly away from volume axis"
  1266.         -field true 
  1267.         -min -10 -max 10
  1268.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1269.         -pre 3 -step 0.5
  1270.         emitterAwayFromAxis;
  1271.  
  1272.     floatSliderGrp -label "Along Axis"
  1273.         -ann "Make particles move along volume axis"
  1274.         -field true 
  1275.         -min -10 -max 10
  1276.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1277.         -pre 3 -step 0.5
  1278.         emitterAlongAxis;
  1279.  
  1280.     floatSliderGrp -label "Around Axis"
  1281.         -ann "Make particles rotate around volume axis"
  1282.         -field true 
  1283.         -min -10 -max 10
  1284.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1285.         -pre 3 -step 0.5
  1286.         emitterAroundAxis;
  1287.  
  1288.     floatSliderGrp -label "Random Direction"
  1289.         -ann "Adds to particle motion a component of this length in random direction"
  1290.         -field true 
  1291.         -min -10 -max 10
  1292.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1293.         -pre 3 -step 0.5
  1294.         emitterRandomSpread;
  1295.  
  1296.     floatSliderGrp -label "Directional Speed"
  1297.         -ann "Adds to particle motion a component of this length in directionX/Y/Z"
  1298.         -field true 
  1299.         -min -10 -max 10
  1300.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1301.         -pre 3 -step 0.5
  1302.         emitterDirectionalSpeed;
  1303.  
  1304.     checkBoxGrp -l "Scale Speed By Size" 
  1305.         -ann "If true, scaling volume changes particle speed"
  1306.         -ncb 1 -l1 "" 
  1307.         emitterScaleSpeedBySize;
  1308.  
  1309.     setParent ..; 
  1310.     setParent ..; 
  1311. }
  1312.  
  1313.  
  1314. global proc createCollisionLayout( string $parent )
  1315. {
  1316.     global float $dynMaxFloatField;
  1317.     global float $dynMinFloatField;
  1318.  
  1319.     setParent $parent;
  1320.     
  1321.     // Drag Name Widget
  1322.     //
  1323.     floatSliderGrp -label "Resilience"
  1324.         -field true
  1325.         -min 0.0 -max 1.0
  1326.         -fmn $dynMinFloatField
  1327.         -fmx $dynMaxFloatField
  1328.         -pre 3  -step 0.1
  1329.         collisionResilience;
  1330.  
  1331.     floatSliderGrp -label "Friction"
  1332.         -field true
  1333.         -min 0.0 -max 1.0
  1334.         -fmn $dynMinFloatField
  1335.         -fmx $dynMaxFloatField
  1336.         -pre 3  -step 0.1
  1337.         collisionFriction;
  1338.  
  1339. }
  1340.  
  1341.  
  1342. global proc createGoalLayout( string $parent )
  1343. {
  1344.     setParent $parent;
  1345.     
  1346.     floatSliderGrp -label "Goal Weight"
  1347.         -field true
  1348.         -min 0.0 -max 1.0
  1349.         -pre 3  -step 0.1
  1350.         goalWeight;
  1351.  
  1352.     checkBoxGrp -label "Use Transform as Goal" 
  1353.         -ncb 1 -l1 ""
  1354.         goalUseTransform;
  1355. }
  1356.  
  1357.  
  1358. global proc createRigidLayout( string $parent )
  1359. {
  1360.     global float $dynMaxFloatField;
  1361.     global float $dynMinFloatField;
  1362.  
  1363.     setParent $parent;
  1364.     
  1365.     // Rigid Body Name Widget
  1366.     //
  1367.     textFieldGrp -l "Rigid Body Name"
  1368.         rigidName;
  1369.  
  1370.     // Rigid Body Attributes Layout
  1371.     //
  1372.     frameLayout -l "Rigid Body Attributes"
  1373.         -bv true -lv true -cll true -cl false -mh 4
  1374.         rigidBodyAttrsF;
  1375.     columnLayout rigidBodyAttrsCL;
  1376.  
  1377.     // Rigid Body Attributes Widgets
  1378.     //
  1379.     checkBoxGrp -l ""
  1380.         -ncb 2
  1381.         -l1 "Active"
  1382.         -l2 "Particle Collision"
  1383.         rigidActiveCollision;
  1384.  
  1385.     floatSliderGrp -l "Mass"
  1386.         -field true
  1387.         -min 0 -max 100
  1388.         -fmn 0 -fmx $dynMaxFloatField
  1389.         -pre 3 -step 0.5
  1390.         rigidMass;
  1391.  
  1392.     checkBoxGrp -l "Set Center of Mass"
  1393.         -ncb 1
  1394.         -l1 ""
  1395.         -onc "dynRigidComCB 1"
  1396.         -ofc "dynRigidComCB 0"
  1397.         rigidComCBox;
  1398.  
  1399.     floatSliderGrp -label "Center of Mass: X" 
  1400.         -field true
  1401.         -min -10 -max 10
  1402.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1403.         -pre 3 -step 0.5
  1404.         rigidComX;
  1405.  
  1406.     floatSliderGrp -label "Y"
  1407.         -field true
  1408.         -min -10 -max 10
  1409.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1410.         -pre 3 -step 0.5
  1411.         rigidComY;
  1412.  
  1413.     floatSliderGrp -label "Z"
  1414.         -field true
  1415.         -min -10 -max 10
  1416.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1417.         -pre 3 -step 0.5
  1418.         rigidComZ;
  1419.  
  1420.     floatSliderGrp -l "Static Friction"
  1421.         -field true
  1422.         -min 0.0 -max 1.0
  1423.         -pre 3 -step 0.1
  1424.         rigidStatFriction;
  1425.  
  1426.     floatSliderGrp -l "Dynamic Friction"
  1427.         -field true
  1428.         -min 0.0 -max 1.0
  1429.         -pre 3 -step 0.1
  1430.         rigidDynFriction;
  1431.  
  1432.     floatSliderGrp -l "Bounciness"
  1433.         -field true
  1434.         -min 0.0 -max 2.0
  1435.         -pre 3 -step 0.1
  1436.         rigidBounciness;
  1437.  
  1438.     floatSliderGrp -l "Damping"
  1439.         -field true
  1440.         -min -2.0 -max 2.0
  1441.         -pre 3 -step 0.1
  1442.         rigidDamping;
  1443.  
  1444.     floatSliderGrp -label "Impulse: X" 
  1445.         -field true
  1446.         -min -10 -max 10
  1447.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1448.         -pre 3 -step 0.5
  1449.         rigidImpulseX;
  1450.  
  1451.     floatSliderGrp -label "Y"
  1452.         -field true
  1453.         -min -10 -max 10
  1454.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1455.         -pre 3 -step 0.5
  1456.         rigidImpulseY;
  1457.  
  1458.     floatSliderGrp -label "Z"
  1459.         -field true
  1460.         -min -10 -max 10
  1461.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1462.         -pre 3 -step 0.5
  1463.         rigidImpulseZ;
  1464.  
  1465.     floatSliderGrp -label "Impulse Position: X" 
  1466.         -field true
  1467.         -min -10 -max 10
  1468.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1469.         -pre 3 -step 0.5
  1470.         rigidImpulsePosX;
  1471.  
  1472.     floatSliderGrp -label "Y"
  1473.         -field true
  1474.         -min -10 -max 10
  1475.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1476.         -pre 3 -step 0.5
  1477.         rigidImpulsePosY;
  1478.  
  1479.     floatSliderGrp -label "Z"
  1480.         -field true
  1481.         -min -10 -max 10
  1482.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1483.         -pre 3 -step 0.5
  1484.         rigidImpulsePosZ;
  1485.  
  1486.     floatSliderGrp -label "Spin Impulse: X" 
  1487.         -field true
  1488.         -min -10 -max 10
  1489.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1490.         -pre 3 -step 0.5
  1491.         rigidSpinImpulseX;
  1492.  
  1493.     floatSliderGrp -label "Y"
  1494.         -field true
  1495.         -min -10 -max 10
  1496.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1497.         -pre 3 -step 0.5
  1498.         rigidSpinImpulseY;
  1499.  
  1500.     floatSliderGrp -label "Z"
  1501.         -field true
  1502.         -min -10 -max 10
  1503.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1504.         -pre 3 -step 0.5
  1505.         rigidSpinImpulseZ;
  1506.  
  1507.     setParent ..;
  1508.     setParent ..;
  1509.  
  1510.     frameLayout -l "Initial Settings"
  1511.         -bv true -lv true -cll true -cl true -mh 4
  1512.         rigidInitialSettingsF;
  1513.     columnLayout rigidInitialSettingsCL;
  1514.  
  1515.     floatSliderGrp -l "Initial Spin: X"
  1516.         -field true
  1517.         -min -10.0 -max 10.0
  1518.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1519.         -pre 3 -step 0.5
  1520.         rigidAngVelocityX;
  1521.  
  1522.     floatSliderGrp -l "Y"
  1523.         -field true
  1524.         -min -10.0 -max 10.0
  1525.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1526.         -pre 3 -step 0.5
  1527.         rigidAngVelocityY;
  1528.  
  1529.     floatSliderGrp -l "Z"
  1530.         -field true
  1531.         -min -10.0 -max 10.0
  1532.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1533.         -pre 3 -step 0.5
  1534.         rigidAngVelocityZ;
  1535.  
  1536.     checkBoxGrp -l "Set Initial Position"
  1537.         -ncb 1
  1538.         -l1 ""
  1539.         -onc "dynRigidPositionCB 1"
  1540.         -ofc "dynRigidPositionCB 0"
  1541.         rigidPosCBox;
  1542.  
  1543.     floatSliderGrp -label "Initial Position: X" 
  1544.         -field true
  1545.         -min -10 -max 10
  1546.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1547.         -pre 3 -step 0.5
  1548.         rigidPosX;
  1549.  
  1550.     floatSliderGrp -label "Y" 
  1551.         -field true
  1552.         -min -10 -max 10
  1553.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1554.         -pre 3 -step 0.5
  1555.         rigidPosY;
  1556.  
  1557.     floatSliderGrp -label "Z" 
  1558.         -field true
  1559.         -min -10 -max 10
  1560.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1561.         -pre 3 -step 0.5
  1562.         rigidPosZ;
  1563.  
  1564.     checkBoxGrp -l "Set Initial Orientation"
  1565.         -ncb 1
  1566.         -l1 ""
  1567.         -onc "dynRigidOrientCB 1"
  1568.         -ofc "dynRigidOrientCB 0"
  1569.         rigidOrCBox;
  1570.  
  1571.     floatSliderGrp -label "Initial Orientation: X" 
  1572.         -field true
  1573.         -min -10 -max 10
  1574.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1575.         -pre 3 -step 0.5
  1576.         rigidOrX;
  1577.  
  1578.     floatSliderGrp -label "Y" 
  1579.         -field true
  1580.         -min -10 -max 10
  1581.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1582.         -pre 3 -step 0.5
  1583.         rigidOrY;
  1584.  
  1585.     floatSliderGrp -label "Z"
  1586.         -field true
  1587.         -min -10 -max 10
  1588.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1589.         -pre 3 -step 0.5
  1590.         rigidOrZ;
  1591.  
  1592.     floatSliderGrp -l "Initial Velocity: X"
  1593.         -field true
  1594.         -min -10.0 -max 10.0
  1595.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1596.         -pre 3 -step 0.5
  1597.         rigidInitVelocityX;
  1598.  
  1599.     floatSliderGrp -l "Y"
  1600.         -field true
  1601.         -min -10.0 -max 10.0
  1602.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1603.         -pre 3 -step 0.5
  1604.         rigidInitVelocityY;
  1605.  
  1606.     floatSliderGrp -l "Z"
  1607.         -field true
  1608.         -min -10.0 -max 10.0
  1609.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1610.         -pre 3 -step 0.5
  1611.         rigidInitVelocityZ;
  1612.  
  1613.     setParent ..;
  1614.     setParent ..;
  1615.  
  1616.     frameLayout -l "Performance Attributes"
  1617.         -bv true -lv true -cll true -cl true -mh 4
  1618.         rigidPerfAttrsF;
  1619.     columnLayout rigidPerfAttrsF;
  1620.  
  1621.     // Collision Types Radio Buttons
  1622.     //
  1623.     optionMenuGrp -l "Stand In" rigidStandInType;
  1624.         menuItem -l "None" standInNone;
  1625.         menuItem -l "Cube" standInCube;
  1626.         menuItem -l "Sphere" standInSphere;
  1627.  
  1628.     intFieldGrp -l "Tessellation Factor"
  1629.         -nf 1
  1630.         rigidTesselation;
  1631.  
  1632.     intFieldGrp -l "Collision Layer"
  1633.         -nf 1
  1634.         rigidLayer;
  1635.  
  1636.     separator;
  1637.  
  1638.     checkBoxGrp -l "Cache Data"
  1639.         -ncb 1
  1640.         -l1 ""
  1641.         rigidCacheCBox;
  1642.  
  1643. }
  1644.  
  1645. global proc createSoftLayout( string $parent )
  1646. {
  1647.  
  1648.     setParent $parent;
  1649.     
  1650.     // Name Widget
  1651.     //
  1652.  
  1653.     // How to make soft Body
  1654.     optionMenuGrp -l "Creation Options" -cc softCBoxCB softCreationOption;
  1655.         menuItem -l "Make Soft" softConvert;
  1656.         menuItem -l "Duplicate, Make Copy Soft" softDuplicate;
  1657.         menuItem -l "Duplicate, Make Original Soft" softConvertAndDuplicate;
  1658.  
  1659.     checkBoxGrp -label "Duplicate Input Graph" 
  1660.         -numberOfCheckBoxes 1 -label1 "" 
  1661.         softHistory;
  1662.  
  1663.     checkBoxGrp -l "Hide Non-Soft Object" 
  1664.         -ncb 1 -l1 "" 
  1665.         softHide;
  1666.  
  1667.     checkBoxGrp -l "Make Non-Soft a Goal" 
  1668.         -ncb 1 -l1 "" 
  1669.         -onc "softGoalCB 1"
  1670.         -ofc "softGoalCB 0"
  1671.         softGoal;
  1672.  
  1673.     floatSliderGrp -label "Weight"
  1674.         -field true
  1675.         -min 0.0 -max 1.0
  1676.         -pre 3 -step 0.1
  1677.         softWeight;
  1678. }
  1679.  
  1680.  
  1681. global proc createConstrainLayout( string $parent )
  1682. {
  1683.     global float $dynMaxFloatField;
  1684.     global float $dynMinFloatField;
  1685.  
  1686.     setParent $parent;
  1687.     
  1688.     // Constrain Name Widget
  1689.     //
  1690.     textFieldGrp -l "Constraint Name"
  1691.         constrainName;
  1692.  
  1693.     separator constrainTypeSep;
  1694.  
  1695.     optionMenuGrp -l "Constraint Type:"
  1696.         -cc dynConstraintTypeCB
  1697.         constrainTypesOM;
  1698.        menuItem -l "Nail" constrainNail;
  1699.        menuItem -l "Pin" constrainPin;
  1700.        menuItem -l "Hinge" constrainHinge;
  1701.        menuItem -l "Spring" constrainSpring;
  1702.        menuItem -l "Barrier" constrainBarrier;
  1703.  
  1704.     // Constrain Interpenetrate Checkbox
  1705.     //
  1706.     checkBoxGrp -l "Interpenetrate"
  1707.         -ncb 1
  1708.         -l1 ""
  1709.         constrainInterCB;
  1710.  
  1711.     separator constrainPosSep;
  1712.  
  1713.     checkBoxGrp -l "Set Initial Position"
  1714.         -ncb 1
  1715.         -l1 ""
  1716.         -onc "dynConstraintPositionCB 1"
  1717.         -ofc "dynConstraintPositionCB 0"
  1718.         constrainPosCBox;
  1719.  
  1720.     text -l "Initial Position" constrainPosT;
  1721.  
  1722.     // Constrain Position Sliders
  1723.     //
  1724.     floatSliderGrp -label "X "
  1725.         -field true
  1726.         -min -100 -max 100
  1727.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1728.         -pre 3 -step 1
  1729.         constrainPosX;
  1730.  
  1731.     floatSliderGrp -label "Y "
  1732.         -field true
  1733.         -min -100 -max 100
  1734.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1735.         -pre 3 -step 1
  1736.         constrainPosY;
  1737.  
  1738.     floatSliderGrp -label "Z "
  1739.         -field true
  1740.         -min -100 -max 100
  1741.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1742.         -pre 3 -step 1
  1743.         constrainPosZ;
  1744.  
  1745.     text -l "Initial Orientation" constrainOrientT;
  1746.  
  1747.     // Constrain Orientation Sliders
  1748.     //
  1749.     floatSliderGrp -label "X "
  1750.         -field true
  1751.         -min -100 -max 100
  1752.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1753.         -pre 3 -step 1
  1754.         constrainOrientX;
  1755.  
  1756.     floatSliderGrp -label "Y "
  1757.         -field true
  1758.         -min -100 -max 100
  1759.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1760.         -pre 3 -step 1
  1761.         constrainOrientY;
  1762.  
  1763.     floatSliderGrp -label "Z "
  1764.         -field true
  1765.         -min -100 -max 100
  1766.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1767.         -pre 3 -step 1
  1768.         constrainOrientZ;
  1769.  
  1770.     // Spring Attribute Sliders
  1771.     //
  1772.     frameLayout -l "Spring Attributes"
  1773.         -bv true -lv true -cll true -cl true -mh 4
  1774.         constraintSpringFL;
  1775.     columnLayout constraintSpringCL;
  1776.  
  1777.     floatSliderGrp -label "Stiffness"
  1778.         -field true
  1779.         -min 0 -max 10
  1780.         -fmn 0 -fmx $dynMaxFloatField
  1781.         -pre 3 -step 0.1
  1782.         constrainSpringStiffness;
  1783.  
  1784.     floatSliderGrp -label "Damping"
  1785.         -field true
  1786.         -min 0 -max 5
  1787.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1788.         -pre 3 -step 0.1
  1789.         constrainSpringDamping;
  1790.  
  1791.     checkBoxGrp -l "Set Spring Rest Length"
  1792.         -ncb 1
  1793.         -l1 ""
  1794.         -onc "dynConstrainSpringRestLengthCB 1"
  1795.         -ofc "dynConstrainSpringRestLengthCB 0"
  1796.         constrainSpringRestLengthCBox;
  1797.  
  1798.     floatSliderGrp -label "Rest Length"
  1799.         -field true
  1800.         -min 0 -max 100
  1801.         -fmn $dynMinFloatField -fmx $dynMaxFloatField
  1802.         -pre 3 -step 0.1
  1803.         constrainSpringRestLength;
  1804.  
  1805.     setParent ..;
  1806.     setParent ..;
  1807.  
  1808. }
  1809.  
  1810.  
  1811. global proc createSpringLayout( string $parent )
  1812. {
  1813.     // These globals contain the lowest min and highest max for the
  1814.     // dynamics float fields.
  1815.     //
  1816.     global float $dynMaxFloatField;
  1817.     global float $dynMinFloatField;
  1818.  
  1819.     setParent $parent;
  1820.  
  1821.     columnLayout -adj true 
  1822.         -columnAttach "both" 5 
  1823.         -columnOffset "both" 5; 
  1824.     
  1825.     // Name Widget
  1826.     //
  1827.     textFieldGrp -l "Spring Name"
  1828.         springName;
  1829.  
  1830.     frameLayout -l "Spring Methods" -labelAlign "bottom"
  1831.         -collapsable true -collapse false;
  1832.     columnLayout;
  1833.  
  1834.     checkBoxGrp -l "Add to Existing Spring" 
  1835.         -ncb 1 -l1 ""
  1836.         -on1 "springAddCB 1"
  1837.         -of1 "springAddCB 0"
  1838.         springAdd;
  1839.  
  1840.     checkBoxGrp -l "Don't Duplicate Springs" 
  1841.         -ncb 1 -l1 "" 
  1842.         springNoDuplicate;
  1843.  
  1844.     checkBoxGrp -l "Set Exclusive" 
  1845.         -ncb 1 -l1 ""
  1846.         springExclusive;
  1847.  
  1848.     optionMenuGrp -l "Creation Method:"
  1849.         -cc ("dynSpringOptionChoiceCB " + $parent)
  1850.         springMethodsOM;
  1851.     menuItem -l "MinMax" springMinMax;
  1852.     menuItem -l "All" springAll;
  1853.     menuItem -l "Wireframe" springWirefram;
  1854.  
  1855.     floatSliderGrp -l "Min Distance"
  1856.         -field true
  1857.         -min 0 -max 100
  1858.         -fmn 0 -fmx $dynMaxFloatField
  1859.         -pre 3 -step 0.5
  1860.         -cc springMinDistCB
  1861.         springMinDistance;
  1862.  
  1863.     floatSliderGrp -l "Max Distance"
  1864.         -field true
  1865.         -min 0 -max 100
  1866.         -fmn 0 -fmx $dynMaxFloatField
  1867.         -pre 3 -step 0.5
  1868.         -cc springMaxDistCB
  1869.         springMaxDistance;
  1870.  
  1871.     intFieldGrp -l "Wire Walk Length"
  1872.         -nf 1
  1873.         springWireWalkLength;
  1874.  
  1875.     setParent ..;
  1876.     setParent ..;
  1877.  
  1878.     frameLayout -l "Spring Attributes" -labelAlign "bottom"
  1879.         -collapsable true -collapse false;
  1880.     columnLayout;
  1881.  
  1882.     checkBoxGrp -l "Use Per-Spring Stiffness"
  1883.         -ncb 1 -l1 ""
  1884.         -on1 "springUseStiffnessPSCB 1"
  1885.         -of1 "springUseStiffnessPSCB 0"
  1886.         springUseStiffnessPS;
  1887.  
  1888.     checkBoxGrp -l "Use Per-Spring Damping" 
  1889.         -ncb 1 -l1 ""
  1890.         -on1 "springUseDampingPSCB 1 "
  1891.         -of1 "springUseDampingPSCB 0"
  1892.         springUseDampingPS;
  1893.  
  1894.     checkBoxGrp -l "Use Per-Spring RestLength" 
  1895.         -ncb 1 -l1 ""
  1896.         -on1 "springUseRestLengthPSCB 1"
  1897.         -of1 "springUseRestLengthPSCB 0"
  1898.         springUseRestLengthPS;
  1899.  
  1900.     floatSliderGrp -label "Stiffness"
  1901.         -field true
  1902.         -min 0 -max 20
  1903.         -fmn 0 -fmx $dynMaxFloatField
  1904.         -pre 3 -step 0.1
  1905.         springStiffness;
  1906.  
  1907.     floatSliderGrp -l "Damping"
  1908.         -field true
  1909.         -min 0 -max 20
  1910.         -fmn 0 -fmx $dynMaxFloatField
  1911.         -pre 3 -step 0.1
  1912.         springDamp;
  1913.  
  1914.     floatSliderGrp -l "Rest Length"
  1915.         -field true
  1916.         -min 0 -max 20
  1917.         -fmn 0 -fmx $dynMaxFloatField
  1918.         -pre 3 -step 0.1
  1919.         springRestLength;
  1920.  
  1921.     floatSliderGrp -l "End1 Weight"
  1922.         -field true
  1923.         -min 0 -max 1
  1924.         -pre 3 -step 0.1
  1925.         springStartForceWeight;
  1926.  
  1927.     floatSliderGrp -l "End2 Weight"
  1928.         -field true
  1929.         -min 0 -max 1
  1930.         -pre 3 -step 0.1
  1931.         springEndForceWeight;
  1932.     setParent ..;
  1933.     setParent ..;
  1934.     setParent ..;
  1935.     setParent ..;
  1936. }
  1937.  
  1938.  
  1939. global proc string getSelectedParticle()
  1940. {
  1941.     string $selectedParticle = "";
  1942.     string $relativeList[];
  1943.     string $selectionList[] = `ls -sl`;
  1944.  
  1945.     int $listCount = size( $selectionList );
  1946.  
  1947.     for ( $i = 0; $i < $listCount; $i++ )
  1948.     {
  1949.         string $typeList[] = `ls -st $selectionList[$i]`;
  1950.  
  1951.         if ( $typeList[1] == "particle" )
  1952.         {
  1953.             $selectedParticle = $typeList[0];
  1954.             break;
  1955.         }
  1956.         else if ( $typeList[1] == "transform" )
  1957.         {
  1958.             $relativeList = `listRelatives $selectionList[$i]`;
  1959.  
  1960.             for ( $j = 0; $j < size( $relativeList ); $j++ )
  1961.             {
  1962.                 $typeList = `ls -st $relativeList[$j]`;
  1963.  
  1964.                 if ( $typeList[1] == "particle" )
  1965.                 {
  1966.                     $selectedParticle = $typeList[0];
  1967.                     break;
  1968.                 }
  1969.             }
  1970.         }
  1971.     }
  1972.  
  1973.     return $selectedParticle;
  1974. }
  1975.  
  1976.  
  1977. // ===================   INTERNAL CONTROL CALLBACKS ===============
  1978. //
  1979. //
  1980. global proc dynAirEnableSpreadCB(int $isSpreadOn)
  1981. {
  1982.     if ($isSpreadOn)
  1983.         floatSliderGrp -e -enable true airSpread;
  1984.     else
  1985.         floatSliderGrp -e -enable false airSpread;
  1986. }
  1987.  
  1988. global proc dynAirPresetsCB(int $whichPreset)
  1989. {
  1990.     if ($whichPreset == 1)
  1991.     {
  1992.         // Wind
  1993.         //
  1994.         floatSliderGrp -e -v 0.0 airInheritVelocity;
  1995.         checkBoxGrp -e -v1 1 airInheritRotation;
  1996.         checkBoxGrp -e -v1 0 airComponent;
  1997.         checkBoxGrp -e -v1 0 airEnableSpread;
  1998.         floatSliderGrp -e -enable false airSpread;
  1999.         floatSliderGrp -e -v 0.5 airSpeed;
  2000.         floatSliderGrp -e -v 5.0 airMagnitude;
  2001.         checkBoxGrp -e -v1 1 airMaxDistCBox;
  2002.         floatSliderGrp -e -v 20.0 -enable true airMaxDistance;
  2003.     }
  2004.     else if ($whichPreset == 2)
  2005.     {
  2006.         // Wake
  2007.         //
  2008.         floatSliderGrp -e -v 1.0 airInheritVelocity;
  2009.         checkBoxGrp -e -v1 0 airInheritRotation;
  2010.         checkBoxGrp -e -v1 1 airComponent;
  2011.         checkBoxGrp -e -v1 0 airEnableSpread;
  2012.         floatSliderGrp -e -enable false airSpread;
  2013.         floatSliderGrp -e -v 0.5 airSpeed;
  2014.         floatSliderGrp -e -v 0.0 airMagnitude;
  2015.         checkBoxGrp -e -v1 1 airMaxDistCBox;
  2016.         floatSliderGrp -e -v 2.0 -enable true airMaxDistance;
  2017.     }
  2018.     else if ($whichPreset == 3)
  2019.     {
  2020.         // Fan
  2021.         //
  2022.         floatSliderGrp -e -v 1.0 airInheritVelocity;
  2023.         checkBoxGrp -e -v1 1 airInheritRotation;
  2024.         checkBoxGrp -e -v1 0 airComponent;
  2025.         checkBoxGrp -e -v1 1 airEnableSpread;
  2026.         floatSliderGrp -e -enable true airSpread;
  2027.         floatSliderGrp -e -v 0.5 airSpread;
  2028.         floatSliderGrp -e -v 0.5 airSpeed;
  2029.         floatSliderGrp -e -v 5.0 airMagnitude;
  2030.         checkBoxGrp -e -v1 1 airMaxDistCBox;
  2031.         floatSliderGrp -e -v 20.0 -enable true airMaxDistance;
  2032.     }
  2033. }
  2034.  
  2035. global proc dynEmitterCycleOptionChoice(string $parent)
  2036. {
  2037.     setParent $parent;
  2038.     int     $choice = `optionMenuGrp -q -sl emitterCycleOM`;
  2039.  
  2040.     if ($choice == 1)  // no cycling
  2041.     {
  2042.         intSliderGrp -e -enable false emitterCycleInterval;
  2043.     }
  2044.     else
  2045.     {
  2046.         intSliderGrp -e -enable true emitterCycleInterval;
  2047.     }
  2048. }
  2049.  
  2050. global proc setDimmingForVolumeEmitterAttributes( string $parent )
  2051. {
  2052.     global int $dynIsCreate;
  2053.  
  2054.     setParent $parent;
  2055.  
  2056.     int     $type = `optionMenuGrp -q -sl emitterTypesOM`;
  2057.     
  2058.     // If we are doing create, then emitterTypesOM has values 1,2,3,
  2059.     // and value 3 is volume.  
  2060.     //
  2061.     if (($dynIsCreate) && ($type == 3))
  2062.         $type = 5;
  2063.  
  2064.     if ($type != 5)
  2065.     {
  2066.         // Non-volume type. Disable all volume controls.
  2067.         //
  2068.         optionMenuGrp -e -enable false emitterVolumeShapeOM;
  2069.         floatSliderGrp  -e -enable false emitterVolumeOffsetX;
  2070.         floatSliderGrp  -e -enable false emitterVolumeOffsetY;
  2071.         floatSliderGrp  -e -enable false emitterVolumeOffsetZ;
  2072.         floatSliderGrp  -e -enable false emitterVolumeSweep;
  2073.         floatSliderGrp  -e -enable false emitterTorusSectionRadius;
  2074.         floatSliderGrp  -e -enable false emitterAwayFromCenter;
  2075.         floatSliderGrp  -e -enable false emitterAwayFromAxis;
  2076.         floatSliderGrp  -e -enable false emitterAlongAxis;
  2077.         floatSliderGrp  -e -enable false emitterAroundAxis;
  2078.         floatSliderGrp  -e -enable false emitterRandomSpread;
  2079.         floatSliderGrp  -e -enable false emitterDirectionalSpeed;
  2080.         checkBoxGrp  -e -enable false emitterDieOnExit;
  2081.         checkBoxGrp  -e -enable false emitterScaleSpeedBySize;
  2082.  
  2083.         text -e -enable true emitterVolumeEnablePrompt;
  2084.         text -e -enable true emitterVolumeSpeedEnablePrompt;
  2085.     }
  2086.     else
  2087.     {    
  2088.         // Volume type.
  2089.         // Set all volume controls to defaults, first
  2090.         //
  2091.         optionMenuGrp -e -enable true emitterVolumeShapeOM;
  2092.         floatSliderGrp  -e -enable true emitterVolumeOffsetX;
  2093.         floatSliderGrp  -e -enable true emitterVolumeOffsetY;
  2094.         floatSliderGrp  -e -enable true emitterVolumeOffsetZ;
  2095.         floatSliderGrp  -e -enable true emitterVolumeSweep;
  2096.         floatSliderGrp  -e -enable false emitterTorusSectionRadius;
  2097.         floatSliderGrp  -e -enable true emitterAwayFromCenter;
  2098.         floatSliderGrp  -e -enable true emitterAwayFromAxis;
  2099.         floatSliderGrp  -e -enable true emitterAlongAxis;
  2100.         floatSliderGrp  -e -enable true emitterAroundAxis;
  2101.         floatSliderGrp  -e -enable true emitterRandomSpread;
  2102.         floatSliderGrp  -e -enable true emitterDirectionalSpeed;
  2103.         checkBoxGrp  -e -enable true emitterDieOnExit;
  2104.         checkBoxGrp  -e -enable true emitterScaleSpeedBySize;
  2105.         text -e -enable false emitterVolumeEnablePrompt;
  2106.         text -e -enable false emitterVolumeSpeedEnablePrompt;
  2107.  
  2108.         int     $volShape = `optionMenuGrp -q -sl emitterVolumeShapeOM`;
  2109.  
  2110.         // Now disable selected ones as necessary
  2111.         //
  2112.         if ($volShape == 1)  // cube
  2113.         {
  2114.             floatSliderGrp  -e -enable false emitterAwayFromAxis;
  2115.             floatSliderGrp  -e -enable false emitterVolumeSweep;
  2116.         }
  2117.         else
  2118.         if ($volShape == 2)  // sphere
  2119.         {
  2120.             floatSliderGrp  -e -enable false emitterAwayFromAxis;
  2121.         }
  2122.         else
  2123.         if ($volShape == 3)  // cylinder
  2124.         {
  2125.             floatSliderGrp  -e -enable false emitterAwayFromCenter;
  2126.         }
  2127.         else
  2128.         if ($volShape == 4)  // cone
  2129.         {
  2130.             floatSliderGrp  -e -enable false emitterAwayFromCenter;
  2131.         }
  2132.         else
  2133.         if ($volShape == 5)  // torus
  2134.         {
  2135.             floatSliderGrp  -e -enable false emitterAwayFromCenter;
  2136.             floatSliderGrp  -e -enable true emitterTorusSectionRadius;
  2137.         }
  2138.     }
  2139. }
  2140.  
  2141. global proc dynEmitterOptionChoice(string $parent)
  2142. {
  2143.     setParent $parent;
  2144.     global int $dynIsCreate;
  2145.  
  2146.     int     $choice = `optionMenuGrp -q -sl emitterTypesOM`;
  2147.  
  2148.     // If we are doing create, then emitterTypesOM has values 1,2,3,
  2149.     // and value 3 is volume.  
  2150.     //
  2151.     if (($dynIsCreate) && ($choice == 3))
  2152.         $choice = 5;
  2153.  
  2154.     floatSliderGrp -e -enable true emitterSpeed;
  2155.  
  2156.     // Omni Point
  2157.     //
  2158.     if ($choice == 1)
  2159.     {
  2160.        checkBoxGrp -e -enable false emitterNeedParentUV;
  2161.        checkBoxGrp -e -enable false emitterScaleRateByObjectSize;
  2162.        floatSliderGrp -e -enable true emitterMinDistance;
  2163.        floatSliderGrp -e -enable true emitterMaxDistance;
  2164.        floatSliderGrp -e -enable false emitterDirectionX;
  2165.        floatSliderGrp -e -enable false emitterDirectionY;
  2166.        floatSliderGrp -e -enable false emitterDirectionZ;
  2167.        floatSliderGrp -e -enable false emitterSpread;
  2168.        floatSliderGrp -e -enable false emitterNormalSpeed;
  2169.        floatSliderGrp -e -enable false emitterTangentSpeed;
  2170.     }
  2171.     // Directional Point
  2172.     //
  2173.     else if ($choice == 2)
  2174.     {
  2175.        checkBoxGrp -e -enable false emitterNeedParentUV;
  2176.        checkBoxGrp -e -enable false emitterScaleRateByObjectSize;
  2177.        floatSliderGrp -e -enable true emitterMinDistance;
  2178.        floatSliderGrp -e -enable true emitterMaxDistance;
  2179.        floatSliderGrp -e -enable true emitterDirectionX;
  2180.        floatSliderGrp -e -enable true emitterDirectionY;
  2181.        floatSliderGrp -e -enable true emitterDirectionZ;
  2182.        floatSliderGrp -e -enable true emitterSpread;
  2183.        floatSliderGrp -e -enable false emitterNormalSpeed;
  2184.        floatSliderGrp -e -enable false emitterTangentSpeed;
  2185.     }
  2186.     // Surface
  2187.     //
  2188.     else if ($choice == 3)
  2189.     {
  2190.        checkBoxGrp -e -enable true emitterNeedParentUV;
  2191.        checkBoxGrp -e -enable true emitterScaleRateByObjectSize;
  2192.        floatSliderGrp -e -enable true emitterMinDistance;
  2193.        floatSliderGrp -e -enable true emitterMaxDistance;
  2194.        floatSliderGrp -e -enable false emitterDirectionX;
  2195.        floatSliderGrp -e -enable false emitterDirectionY;
  2196.        floatSliderGrp -e -enable false emitterDirectionZ;
  2197.        floatSliderGrp -e -enable false emitterSpread;
  2198.        floatSliderGrp -e -enable true emitterNormalSpeed;
  2199.        floatSliderGrp -e -enable true emitterTangentSpeed;
  2200.     }
  2201.     // Curve
  2202.     //
  2203.     else if ($choice == 4)
  2204.     {
  2205.        checkBoxGrp -e -enable false emitterNeedParentUV;
  2206.        checkBoxGrp -e -enable true emitterScaleRateByObjectSize;
  2207.        floatSliderGrp -e -enable true emitterMinDistance;
  2208.        floatSliderGrp -e -enable true emitterMaxDistance;
  2209.        floatSliderGrp -e -enable true emitterDirectionX;
  2210.        floatSliderGrp -e -enable true emitterDirectionY;
  2211.        floatSliderGrp -e -enable true emitterDirectionZ;
  2212.        floatSliderGrp -e -enable true emitterSpread;
  2213.        floatSliderGrp -e -enable true emitterNormalSpeed;
  2214.        floatSliderGrp -e -enable true emitterTangentSpeed;
  2215.     }
  2216.     // Volume
  2217.     //
  2218.     else if ($choice == 5)
  2219.     {
  2220.        floatSliderGrp -e -enable false emitterSpeed;
  2221.        checkBoxGrp -e -enable false emitterNeedParentUV;
  2222.        checkBoxGrp -e -enable true emitterScaleRateByObjectSize;
  2223.        floatSliderGrp -e -enable false emitterMinDistance;
  2224.        floatSliderGrp -e -enable false emitterMaxDistance;
  2225.        floatSliderGrp -e -enable true emitterDirectionX;
  2226.        floatSliderGrp -e -enable true emitterDirectionY;
  2227.        floatSliderGrp -e -enable true emitterDirectionZ;
  2228.        floatSliderGrp -e -enable false emitterSpread;
  2229.        floatSliderGrp -e -enable false emitterNormalSpeed;
  2230.        floatSliderGrp -e -enable false emitterTangentSpeed;
  2231.     }
  2232.  
  2233.     setDimmingForVolumeEmitterAttributes( $parent );
  2234. }
  2235.  
  2236. global proc emitterMaxDistCB()
  2237. {
  2238.  
  2239.     // If the user sets max distance less than min distance,
  2240.     // reset min distance to be the same as max distance.
  2241.     //
  2242.     float $minDist = `floatSliderGrp -q -v  emitterMinDistance`;
  2243.     float $maxDist = `floatSliderGrp -q -v  emitterMaxDistance`;
  2244.  
  2245.     if ($maxDist < $minDist)
  2246.     {
  2247.         floatSliderGrp -e -v $maxDist emitterMinDistance;
  2248.     }
  2249. }
  2250.  
  2251. global proc emitterMinDistCB()
  2252. {
  2253.     // If the user sets min distance greater than max distance,
  2254.     // reset max distance to be the same as min distance.
  2255.     //
  2256.     float $minDist = `floatSliderGrp -q -v  emitterMinDistance`;
  2257.     float $maxDist = `floatSliderGrp -q -v  emitterMaxDistance`;
  2258.  
  2259.     if ($minDist > $maxDist)
  2260.     {
  2261.         floatSliderGrp -e -v $minDist emitterMaxDistance;
  2262.     }
  2263. }
  2264.  
  2265. global proc dynRigidPositionCB(int $isOn)
  2266. {
  2267.     if ($isOn)
  2268.     {
  2269.         floatSliderGrp -e -enable true rigidPosX;
  2270.         floatSliderGrp -e -enable true rigidPosY;
  2271.         floatSliderGrp -e -enable true rigidPosZ;
  2272.     }
  2273.     else
  2274.     {
  2275.         floatSliderGrp -e -enable false rigidPosX;
  2276.         floatSliderGrp -e -enable false rigidPosY;
  2277.         floatSliderGrp -e -enable false rigidPosZ;
  2278.     }
  2279. }
  2280.  
  2281.  
  2282. global proc dynRigidOrientCB(int $isOn)
  2283. {
  2284.     if ($isOn)
  2285.     {
  2286.         floatSliderGrp -e -enable true rigidOrX;
  2287.         floatSliderGrp -e -enable true rigidOrY;
  2288.         floatSliderGrp -e -enable true rigidOrZ;
  2289.     }
  2290.     else
  2291.     {
  2292.         floatSliderGrp -e -enable false rigidOrX;
  2293.         floatSliderGrp -e -enable false rigidOrY;
  2294.         floatSliderGrp -e -enable false rigidOrZ;
  2295.     }
  2296. }
  2297.  
  2298.  
  2299. global proc dynRigidComCB(int $isOn)
  2300. {
  2301.     if ($isOn)
  2302.     {
  2303.         floatSliderGrp -e -enable true rigidComX;
  2304.         floatSliderGrp -e -enable true rigidComY;
  2305.         floatSliderGrp -e -enable true rigidComZ;
  2306.     }
  2307.     else
  2308.     {
  2309.         floatSliderGrp -e -enable false rigidComX;
  2310.         floatSliderGrp -e -enable false rigidComY;
  2311.         floatSliderGrp -e -enable false rigidComZ;
  2312.     }
  2313. }
  2314.  
  2315.  
  2316. global proc dynConstraintEnableInterpenetrate(int $enable)
  2317. {
  2318.     if ($enable)
  2319.     {
  2320.         checkBoxGrp -e -enable true constrainInterCB;
  2321.     }
  2322.     else
  2323.     {
  2324.         checkBoxGrp -e -enable false constrainInterCB;
  2325.     }
  2326. }
  2327.  
  2328.  
  2329. global proc dynConstraintEnableSpring( int $enable)
  2330. {
  2331.     if ($enable)
  2332.     {
  2333.         floatSliderGrp -e -enable true constrainSpringStiffness;
  2334.         floatSliderGrp -e -enable true constrainSpringDamping;
  2335.         checkBoxGrp    -e -enable true constrainSpringRestLengthCBox;
  2336.  
  2337.         if (`optionVar -q constrainSpringRestLengthCBox`)
  2338.             floatSliderGrp -e -enable true constrainSpringRestLength;
  2339.         else
  2340.             floatSliderGrp -e -enable false constrainSpringRestLength;
  2341.     }
  2342.     else
  2343.     {
  2344.         floatSliderGrp -e -enable false constrainSpringStiffness;
  2345.         floatSliderGrp -e -enable false constrainSpringDamping;
  2346.         floatSliderGrp -e -enable false constrainSpringRestLength;
  2347.         checkBoxGrp -e -enable false constrainSpringRestLengthCBox;
  2348.     }
  2349. }
  2350.  
  2351.  
  2352. global proc dynConstraintOrientationCB(int $isOn)
  2353. {
  2354.     if ($isOn)
  2355.     {
  2356.         floatSliderGrp -e -enable true constrainOrientX;
  2357.         floatSliderGrp -e -enable true constrainOrientY;
  2358.         floatSliderGrp -e -enable true constrainOrientZ;
  2359.     }
  2360.     else
  2361.     {
  2362.         floatSliderGrp -e -enable false constrainOrientX;
  2363.         floatSliderGrp -e -enable false constrainOrientY;
  2364.         floatSliderGrp -e -enable false constrainOrientZ;
  2365.     }
  2366. }
  2367.  
  2368. global proc dynConstraintTypeCB()
  2369. {
  2370.     int     $option = `optionMenuGrp -q -sl constrainTypesOM`;
  2371.  
  2372.     switch ($option) {
  2373.         // Nail
  2374.         //
  2375.         case 1:
  2376.             dynConstraintEnableSpring(0);
  2377.             dynConstraintEnableInterpenetrate(0);
  2378.             dynConstraintOrientationCB(0);
  2379.             break;
  2380.  
  2381.         // Pin
  2382.         //
  2383.         case 2:
  2384.             dynConstraintEnableSpring(0);
  2385.             dynConstraintEnableInterpenetrate(1);
  2386.             dynConstraintOrientationCB(0);
  2387.             break;
  2388.         
  2389.         // Hinge
  2390.         //
  2391.         case 3:
  2392.             dynConstraintEnableSpring(0);
  2393.             dynConstraintEnableInterpenetrate(1);
  2394.             dynConstraintOrientationCB(1);
  2395.             break;
  2396.  
  2397.         // Spring
  2398.         //
  2399.         case 4:
  2400.             dynConstraintEnableSpring(1);
  2401.             dynConstraintEnableInterpenetrate(1);
  2402.             dynConstraintOrientationCB(0);
  2403.             break;
  2404.  
  2405.         // Barrier
  2406.         //
  2407.         case 5:
  2408.             dynConstraintEnableSpring(0);
  2409.             dynConstraintEnableInterpenetrate(0);
  2410.             dynConstraintOrientationCB(1);
  2411.             break;
  2412.         default:
  2413.             break;
  2414.     }
  2415. }
  2416.  
  2417. global proc dynConstraintPositionCB(int $isOn)
  2418. {
  2419.     if ($isOn)
  2420.     {
  2421.         floatSliderGrp -e -enable true constrainPosX;
  2422.         floatSliderGrp -e -enable true constrainPosY;
  2423.         floatSliderGrp -e -enable true constrainPosZ;
  2424.     }
  2425.     else
  2426.     {
  2427.         floatSliderGrp -e -enable false constrainPosX;
  2428.         floatSliderGrp -e -enable false constrainPosY;
  2429.         floatSliderGrp -e -enable false constrainPosZ;
  2430.     }
  2431. }
  2432.  
  2433.  
  2434. global proc dynConstrainSpringRestLengthCB(int $isOn)
  2435. {
  2436.     if ($isOn)
  2437.         floatSliderGrp -e -enable true constrainSpringRestLength;
  2438.     else
  2439.         floatSliderGrp -e -enable false constrainSpringRestLength;
  2440. }
  2441.  
  2442.  
  2443. global proc softGoalCB(int $isOn)
  2444. //
  2445. // Description:
  2446. //   set the goal slider control enabled iff the weight option
  2447. // box is checked.
  2448. {
  2449.     if ($isOn)
  2450.         floatSliderGrp -e -enable true softWeight;
  2451.     else
  2452.         floatSliderGrp -e -enable false softWeight;
  2453.  
  2454.     // softCBoxCB();
  2455. }
  2456.  
  2457.  
  2458.  
  2459. global proc softCBoxCB()
  2460. //
  2461. // Description:
  2462. //   enable/disable the option box choices which are revelant only
  2463. // for the duplicate creation options.
  2464. {
  2465.     int $isDup = `optionMenuGrp -q -sl softCreationOption`;
  2466.  
  2467.     if ($isDup != 1)
  2468.     {
  2469.         // One of the duplicate choices is on, so enable
  2470.         // the duplicate options.
  2471.         
  2472.         checkBoxGrp -e -enable true softHide;
  2473.         checkBoxGrp -e -enable true softGoal;
  2474.         checkBoxGrp -e -enable true softHistory;
  2475.     }
  2476.     else
  2477.     {
  2478.         // Convert in place; turn duplicate options off.
  2479.         //
  2480.         checkBoxGrp -e -enable false softHide;
  2481.         checkBoxGrp -e -enable false softGoal;
  2482.         checkBoxGrp -e -enable false softHistory;
  2483.     }
  2484. }
  2485.  
  2486.  
  2487. global proc dynSpringOptionChoiceCB(string $parent)
  2488. {
  2489.     setParent $parent;
  2490.  
  2491.     int     $choice = `optionMenuGrp -q -sl springMethodsOM`;
  2492.  
  2493.     if ($choice == 1)
  2494.     {
  2495.         floatSliderGrp -e -enable true springMinDistance;
  2496.         floatSliderGrp -e -enable true springMaxDistance;
  2497.     }
  2498.     else
  2499.     {
  2500.         floatSliderGrp -e -enable false springMinDistance;
  2501.         floatSliderGrp -e -enable false springMaxDistance;
  2502.     }
  2503.     if ($choice == 3)
  2504.     {
  2505.         checkBoxGrp -e -enable false springExclusive;
  2506.     }
  2507.     else
  2508.     {
  2509.         checkBoxGrp -e -enable true springExclusive;
  2510.     }
  2511. }
  2512.  
  2513.  
  2514. global proc springAddCB(int $isOn)
  2515. {
  2516.     // If the user is adding springs to an existing spring object, don't
  2517.     // allow to "edit" the attribute values.
  2518.     //
  2519.     if ($isOn)
  2520.     {
  2521.         checkBoxGrp -e -enable false springUseStiffnessPS;
  2522.         checkBoxGrp -e -enable false springUseDampingPS;
  2523.         checkBoxGrp -e -enable false springUseRestLengthPS;
  2524.  
  2525.         floatSliderGrp -e -enable false springStiffness;
  2526.         floatSliderGrp -e -enable false springDamp;
  2527.         floatSliderGrp -e -enable false springRestLength;
  2528.         floatSliderGrp -e -enable false springStartForceWeight;
  2529.         floatSliderGrp -e -enable false springEndForceWeight;
  2530.     }
  2531.     else
  2532.     {
  2533.         checkBoxGrp -e -enable true springUseStiffnessPS;
  2534.         checkBoxGrp -e -enable true springUseDampingPS;
  2535.         checkBoxGrp -e -enable true springUseRestLengthPS;
  2536.  
  2537.         floatSliderGrp -e -enable true springStartForceWeight;
  2538.         floatSliderGrp -e -enable true springEndForceWeight;
  2539.  
  2540.         if (`checkBoxGrp -q -v1 springUseStiffnessPS`)
  2541.             floatSliderGrp -e -enable false springStiffness;
  2542.         else
  2543.             floatSliderGrp -e -enable true springStiffness;
  2544.  
  2545.         if (`checkBoxGrp -q -v1 springUseDampingPS`)
  2546.             floatSliderGrp -e -enable false springDamp;
  2547.         else
  2548.             floatSliderGrp -e -enable true springDamp;
  2549.  
  2550.         if (`checkBoxGrp -q -v1 springUseRestLengthPS`)
  2551.             floatSliderGrp -e -enable false springRestLength;
  2552.         else
  2553.             floatSliderGrp -e -enable true springRestLength;
  2554.     }
  2555. }
  2556.  
  2557.  
  2558. global proc springUseStiffnessPSCB(int $isOn)
  2559. {
  2560.     if ($isOn)
  2561.     {
  2562.         floatSliderGrp -e -enable false springStiffness;
  2563.     }
  2564.     else
  2565.     {
  2566.         floatSliderGrp -e -enable true springStiffness;
  2567.     }
  2568. }
  2569.  
  2570. global proc springUseDampingPSCB(int $isOn)
  2571. {
  2572.     if ($isOn)
  2573.     {
  2574.         floatSliderGrp -e -enable false springDamp;
  2575.     }
  2576.     else
  2577.     {
  2578.         floatSliderGrp -e -enable true springDamp;
  2579.     }
  2580. }
  2581.  
  2582. global proc springUseRestLengthPSCB(int $isOn)
  2583. {
  2584.     if ($isOn)
  2585.     {
  2586.         floatSliderGrp -e -enable false springRestLength;
  2587.     }
  2588.     else
  2589.     {
  2590.         floatSliderGrp -e -enable true springRestLength;
  2591.     }
  2592. }
  2593.  
  2594.  
  2595. global proc springMaxDistCB()
  2596. {
  2597.     // If the user sets max distance less than min distance,
  2598.     // reset min distance to be the same as max distance.
  2599.     //
  2600.     float $minDist = `floatSliderGrp -q -v  springMinDistance`;
  2601.     float $maxDist = `floatSliderGrp -q -v  springMaxDistance`;
  2602.  
  2603.     if ($maxDist < $minDist)
  2604.     {
  2605.         floatSliderGrp -e -v $maxDist springMinDistance;
  2606.     }
  2607. }
  2608.  
  2609.  
  2610. global proc springMinDistCB()
  2611. {
  2612.     // If the user sets min distance greater than max distance,
  2613.     // reset max distance to be the same as min distance.
  2614.     //
  2615.     float $minDist = `floatSliderGrp -q -v  springMinDistance`;
  2616.     float $maxDist = `floatSliderGrp -q -v  springMaxDistance`;
  2617.  
  2618.     if ($minDist > $maxDist)
  2619.     {
  2620.         floatSliderGrp -e -v $minDist springMaxDistance;
  2621.     }
  2622. }
  2623.  
  2624. // ===================   UTILITY PROCS ===============
  2625. //
  2626. //
  2627.  
  2628. global proc PIwatchCycleOption()
  2629. {
  2630.     if ((`optionMenuGrp -q -exists PIautoCycleOM` == 0) ||
  2631.         (`optionMenuGrp -q -exists  ObjectIndexOM` == 0))
  2632.         return;
  2633.  
  2634.     string $cycleValue = `optionMenuGrp -q -v PIautoCycleOM`;
  2635.     if( $cycleValue == "None" )
  2636.     {
  2637.         optionMenuGrp -e -enable 1 ObjectIndexOM;
  2638.         optionMenuGrp -e -enable 0 CycleStartObjectOM;
  2639.         optionMenuGrp -e -enable 0 AgeOM;
  2640.         optionMenuGrp -e -enable 0 PIautoCycleStepUnitsOM;
  2641.         floatSliderGrp -e -enable 0 PIautoCycleStepSize;
  2642.     }
  2643.     else
  2644.     {
  2645.         optionMenuGrp -e -enable 0 ObjectIndexOM;
  2646.         optionMenuGrp -e -enable 1 CycleStartObjectOM;
  2647.         optionMenuGrp -e -enable 1 AgeOM;
  2648.         optionMenuGrp -e -enable 1 PIautoCycleStepUnitsOM;
  2649.         floatSliderGrp -e -enable 1 PIautoCycleStepSize;
  2650.     }
  2651. }
  2652.  
  2653. global proc PIcreateDynamicAttrOptionMenus() 
  2654. {
  2655.     string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; 
  2656.  
  2657.     if ( size( $particleName ) > 0 ) 
  2658.     {
  2659.         string $vectorList[];
  2660.         string $doubleList[];
  2661.  
  2662.         int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`;
  2663.  
  2664.         if ( $displayAll == 0 )
  2665.         {
  2666.             $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 );
  2667.             $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 );
  2668.         }
  2669.         else
  2670.         {
  2671.             $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 );
  2672.             $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 );
  2673.         }
  2674.  
  2675.     separator -style "out" PIparticleInstancerGeneralSeparator;
  2676.     frameLayout
  2677.         -collapse 0
  2678.         -collapsable 0
  2679.         -borderVisible 0
  2680.         -label "General Options"
  2681.         PIparticleInstancerGeneralFrame;
  2682.         columnLayout PIparticleInstancerGeneralFrameColumn;
  2683.         PIcreateDynamicMenuItem( $vectorList, "Position",     "worldPosition" );
  2684.         PIcreateDynamicMenuItem( $vectorList, "Scale",        "None" );
  2685.         PIcreateDynamicMenuItem( $vectorList, "Shear",        "None" );
  2686.         PIcreateDynamicMenuItem( $doubleList, "Visibility",       "None" );
  2687.         PIcreateDynamicMenuItem( $doubleList, "ObjectIndex",      "None" );
  2688.  
  2689.         setParent ..;
  2690.         setParent ..;
  2691.     
  2692.         separator -style "out" PIparticleInstancerRotationSeparator;
  2693.         frameLayout
  2694.             -collapse 0
  2695.             -collapsable 0
  2696.             -borderVisible 0
  2697.             -label "Rotation Options"
  2698.             PIparticleInstancerRotationFrame;
  2699.             columnLayout PIparticleInstancerRotationFrameColumn;
  2700.             PIcreateDynamicMenuItem( $doubleList, "RotationType",   "None" );
  2701.             PIcreateDynamicMenuItem( $vectorList, "Rotation",     "None" );
  2702.             PIcreateDynamicMenuItem( $vectorList, "AimDirection", "None" );
  2703.             PIcreateDynamicMenuItem( $vectorList, "AimPosition",  "None" );
  2704.             PIcreateDynamicMenuItem( $vectorList, "AimAxis",      "None" );
  2705.             PIcreateDynamicMenuItem( $vectorList, "AimUpAxis",    "None" );
  2706.             PIcreateDynamicMenuItem( $vectorList, "AimWorldUp",   "None" );
  2707.     
  2708.         setParent ..;
  2709.         setParent ..;
  2710.     
  2711.         separator -style "out" PIparticleInstancerCycleSeparator;
  2712.         frameLayout
  2713.             -collapse 0
  2714.             -collapsable 0
  2715.             -borderVisible 0
  2716.             -label "Cycle Options"
  2717.             PIdynParticleInstancerCycleFrame;
  2718.             columnLayout PIdynParticleInstancerCycleFrameColumn;
  2719.             PIcreateDynamicMenuItem( $doubleList, "CycleStartObject", "None" );
  2720.             PIcreateDynamicMenuItem( $doubleList, "Age",               "age" );
  2721.     
  2722.         setParent ..;
  2723.         setParent ..;
  2724.     }
  2725.  
  2726.     PIwatchCycleOption();
  2727. }
  2728.  
  2729.  
  2730. global proc int PIcreateParticleObjectList() 
  2731. {
  2732.     int    $i;
  2733.     string $particleList[] = `ls -typ particle`;
  2734.     int    $count          = size( $particleList );
  2735.  
  2736.  
  2737.     if ( $count == 0 )
  2738.     {
  2739.         menuItem -l "No Particle Shapes Found" PInoParticleShapes;
  2740.     }
  2741.     else
  2742.     {
  2743.         for ( $i = 0; $i < $count; $i++ )
  2744.         {
  2745.             menuItem -l $particleList[$i] $particleList[$i];
  2746.         }
  2747.     }
  2748.  
  2749.     return $count;
  2750. }
  2751.  
  2752.  
  2753. global proc __INST_OBJ_LIST_fillItemList()
  2754. {
  2755.     global string $__INST_OBJ_LIST_items[];
  2756.     int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`;
  2757.     textScrollList -e -visible 0 PIselectObjectList;
  2758.     textScrollList -e -removeAll PIselectObjectList;
  2759.  
  2760.     int $i;
  2761.     if( size($__INST_OBJ_LIST_items) == 0 )
  2762.     {
  2763.         textScrollList -e -append " " -width 380 PIselectObjectList;
  2764.     }
  2765.     else
  2766.     {
  2767.         for( $i = 0; $i < size($__INST_OBJ_LIST_items); $i ++ )
  2768.         {
  2769.             string $newText = ($i + ": " + $__INST_OBJ_LIST_items[$i]);
  2770.             textScrollList -e -append $newText -width 380 PIselectObjectList;
  2771.         }
  2772.     }
  2773.  
  2774.     int $firstSelected = $selectedIndices[0];
  2775.     if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` )
  2776.     {
  2777.         int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList`;
  2778.         textScrollList -e -showIndexedItem $selectThis PIselectObjectList;
  2779.     }
  2780.     textScrollList -e -visible 1 PIselectObjectList;
  2781. }
  2782.  
  2783. global proc __INST_OBJ_LIST_addItemsFromList( string $list[] )
  2784. {
  2785.     global string $__INST_OBJ_LIST_items[];
  2786.  
  2787.     int $i;
  2788.     for( $i = 0; $i < size($list); $i ++ )
  2789.     {
  2790.         if( isValidInstancedObject( $list[$i] ) == 1 )
  2791.         {
  2792.             int $found = 0;
  2793.             int $j;
  2794.             for( $j = 0; $j < size($__INST_OBJ_LIST_items); $j ++ )
  2795.             {
  2796.                 if( $list[$i] == $__INST_OBJ_LIST_items[$j] )
  2797.                 {
  2798.                     $found = 1;
  2799.                 }
  2800.             }
  2801.             if( $found == 0 )
  2802.             {
  2803.                 $__INST_OBJ_LIST_items[size($__INST_OBJ_LIST_items)] = $list[$i];
  2804.             }
  2805.         }
  2806.     }
  2807.  
  2808.     __INST_OBJ_LIST_fillItemList();
  2809. }
  2810.  
  2811. global proc __INST_OBJ_LIST_addItemsFromSelectionList()
  2812. {
  2813.     global string $__INST_OBJ_LIST_items[];
  2814.  
  2815.     string $selectedItems[] = `ls -sl`;
  2816.     __INST_OBJ_LIST_addItemsFromList( $selectedItems );
  2817. }
  2818.  
  2819. global proc createParticleInstancerLayout( string $parent )
  2820. {
  2821.     setParent $parent;
  2822.  
  2823.     textFieldGrp -l "Particle Instancer Name" particleInstancerName;
  2824.  
  2825.     optionMenuGrp -l "Rotation Units" PIrotationUnitsOM;
  2826.  
  2827.            menuItem -l "Degrees"   PIdegreesRotationUnits;
  2828.            menuItem -l "Radians"   PIradiansRotationUnits;
  2829.  
  2830.     optionMenuGrp -l "Rotation Order" PIrotationOrderOM;
  2831.  
  2832.            menuItem -l "XYZ" PIxyzRotationOrder;
  2833.            menuItem -l "XZY" PIxzyRotationOrder;
  2834.            menuItem -l "YXZ" PIyxzRotationOrder;
  2835.            menuItem -l "YZX" PIyzxRotationOrder;
  2836.            menuItem -l "ZXY" PIzxyRotationOrder;
  2837.            menuItem -l "ZYX" PIzyxRotationOrder;
  2838.  
  2839.     optionMenuGrp -l "Level Of Detail" PIlevelOfDetailOM;
  2840.  
  2841.            menuItem -l "Geometry"      PIgeometryLevelOfDetail;
  2842.            menuItem -l "BoundingBox"   PIboundingBoxLevelOfDetail;
  2843.            menuItem -l "BoundingBoxes" PIboundingBoxesLevelOfDetail;
  2844.  
  2845.     // Cycle Types 
  2846.     // 
  2847.     optionMenuGrp -l "Cycle" -cc "PIwatchCycleOption()" PIautoCycleOM;
  2848.  
  2849.         menuItem -l "None"          PIautoCycleNone;
  2850.         menuItem -l "Sequential" PIautoCycleSequential;
  2851.  
  2852.     // Cycle Step Units option menu.
  2853.     //
  2854.     optionMenuGrp -l "Cycle Step Units" PIautoCycleStepUnitsOM;
  2855.  
  2856.         menuItem -l "Frames"  PIautoCycleStepFrames;
  2857.         menuItem -l "Seconds" PIautoCycleStepSeconds;
  2858.  
  2859.     // Cycle Step Size float/slider.
  2860.     //
  2861.     floatSliderGrp -l "Cycle Step Size"
  2862.         -field true 
  2863.         -min 0 -max 10
  2864.         -fmn 0 -fmx 10000
  2865.         -pre 1 -step 0.5
  2866.         PIautoCycleStepSize;
  2867.  
  2868.     separator particleInstancerSep1;
  2869.  
  2870.     global string $__INST_OBJ_LIST_items[];
  2871.     clear($__INST_OBJ_LIST_items);
  2872.  
  2873.     rowColumnLayout
  2874.         -columnWidth 1 400
  2875.         -numberOfColumns 1
  2876.         -columnAttach 1 "both" 0
  2877.         mainLayout;
  2878.  
  2879.     text
  2880.         -label "Instanced Objects"
  2881.         mainListLabel;
  2882.  
  2883.     textScrollList
  2884.         -width 390
  2885.         -height 94
  2886.         -allowMultiSelection true
  2887.         -removeAll
  2888.         -annotation "List of the instanced objects and their indices into the instancer."
  2889.         PIselectObjectList;
  2890.  
  2891.     rowColumnLayout
  2892.         -numberOfColumns 4
  2893.         -columnWidth 1 100
  2894.         -columnWidth 2 100
  2895.         -columnWidth 3 100
  2896.         -columnWidth 4 100
  2897.         -columnAlign 1 "center"
  2898.         -columnAlign 2 "center"
  2899.         -columnAlign 3 "center"
  2900.         -columnAlign 4 "center"
  2901.         -columnAttach 1 "both" 0
  2902.         -columnAttach 2 "both" 0
  2903.         -columnAttach 3 "both" 0
  2904.         -columnAttach 4 "both" 0
  2905.         -rowAttach 1 "top" 2
  2906.         -rowAttach 2 "top" 2
  2907.         -rowAttach 3 "top" 2
  2908.         -rowAttach 4 "top" 2
  2909.         existingItemButtonLayout;
  2910.  
  2911.     button
  2912.         -label "Add Selection"
  2913.         -width 90
  2914.         -command "__INST_OBJ_LIST_addItemsFromSelectionList()"
  2915.         -annotation "Add selected object(s) to the list."
  2916.         addItemsButton;
  2917.  
  2918.     button
  2919.         -label "Remove Items"
  2920.         -width 90
  2921.         -command "__INST_OBJ_LIST_removeSelectedItems()"
  2922.         -annotation "Remove the highlighted item(s) from the list."
  2923.         removeItemsButton;
  2924.  
  2925.     button
  2926.         -label "Move Up"
  2927.         -width 90
  2928.         -command "__INST_OBJ_LIST_moveSelectedItemsUp()"
  2929.         -annotation "Move highlighted item(s) higher in the list."
  2930.         moveItemsUpButton;
  2931.  
  2932.  
  2933.     button
  2934.         -label "Move Down"
  2935.         -width 90
  2936.         -command "__INST_OBJ_LIST_moveSelectedItemsDown()"
  2937.         -annotation "Move highlighted item(s) lower in the list."
  2938.         moveItemsDownButton;
  2939.  
  2940.     __INST_OBJ_LIST_addItemsFromSelectionList();
  2941.  
  2942.     setParent ..;
  2943.     setParent ..;
  2944.  
  2945.     separator particleInstancerSep2;
  2946.  
  2947.     checkBoxGrp -l "Allow All Data Types" 
  2948.         -ncb 1 -v1 0 -l1 ""
  2949.         -cc ("PIparticleOptionChanged " + $parent)
  2950.         PIdisplayAllTypes;
  2951.  
  2952.     // Particle Object Dynamic Option Menu.
  2953.     //
  2954.     optionMenuGrp -l "Particle Object To Instance" 
  2955.         -cc ("PIparticleOptionChanged " + $parent) PIparticleObjectOM;
  2956.  
  2957.     // We only want to create the dynamic attribute list if we have 
  2958.     // a valid particle shape.
  2959.     //
  2960.     if ( PIcreateParticleObjectList() > 0 )
  2961.     {
  2962.         PIcreateDynamicAttrOptionMenus();
  2963.     }
  2964.  
  2965.     setParent ..;
  2966. }
  2967.  
  2968.  
  2969. global proc PIeditDynamicMenuItem( string $list[], string $attrName, int $validHeadSize )
  2970. {
  2971.     int    $index = 1;
  2972.     string $miName;
  2973.     string $omName = $attrName + "OM";
  2974.  
  2975.     optionMenuGrp -e -l $attrName $omName;
  2976.  
  2977.     string $omList[] = `optionMenuGrp -q -itemListShort $omName`;
  2978.  
  2979.     int $currentSize = size( $omList ); 
  2980.     int $listSize    = size( $list ); 
  2981.  
  2982.     setParent  $omName;
  2983.     string $menuParent = `setParent -q`;
  2984.     string $parent = `setParent -m ($menuParent + "|OptionMenu")`;
  2985.  
  2986.     // Make sure that all attributes have a "None" menu item except
  2987.     // for "Position" which always needs to have a valid value.
  2988.     //
  2989.     int $offset = 0;
  2990.     if ( $attrName != "Position" ) 
  2991.     {
  2992.         $listSize += 1;
  2993.         $offset = 1;
  2994.     }
  2995.  
  2996.     if ( $listSize > $currentSize )
  2997.     {
  2998.         //
  2999.         // Add more entries if needed.
  3000.         //
  3001.         for ( $i = $currentSize; $i < $listSize; $i++ )
  3002.         {
  3003.             $index  = $i + 1;
  3004.             $miName = $attrName + "MenuItem" + $index;
  3005.                menuItem -l $list[$i] $miName;
  3006.         }
  3007.     }
  3008.     else if ( $listSize < $currentSize )
  3009.     {
  3010.         //
  3011.         // Remove extra entries.
  3012.         //
  3013.         for ( $i = $listSize; $i < $currentSize; $i++ )
  3014.         {
  3015.             deleteUI $omList[$i];
  3016.         }
  3017.     }
  3018.  
  3019.     $index = $validHeadSize+$offset+1;
  3020.     int $listIndex = $validHeadSize;
  3021.     
  3022.     for ( $i = $validHeadSize + $offset; $i < $listSize; $i++ )
  3023.     {
  3024.         $miName = $attrName + "MenuItem" + $index;
  3025.  
  3026.         menuItem -e -l $list[$listIndex] $miName;
  3027.         $index++;
  3028.         $listIndex++;
  3029.     }
  3030. }
  3031.  
  3032.  
  3033. global proc PIeditDynamicAttrOptionMenus() 
  3034. {
  3035.     string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; 
  3036.  
  3037.     if ( size( $particleName ) > 0 )
  3038.     {
  3039.         string $vectorList[];
  3040.         string $doubleList[];
  3041.  
  3042.         int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`;
  3043.  
  3044.         if ( $displayAll == 0 )
  3045.         {
  3046.             $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 );
  3047.             $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 );
  3048.         }
  3049.         else
  3050.         {
  3051.             $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 );
  3052.             $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 );
  3053.         }
  3054.  
  3055.         PIeditDynamicMenuItem( $vectorList, "Position", 9 );
  3056.         PIeditDynamicMenuItem( $vectorList, "Scale", 9 );
  3057.         PIeditDynamicMenuItem( $vectorList, "Shear", 9 );
  3058.         PIeditDynamicMenuItem( $doubleList, "Visibility", 4 );
  3059.         PIeditDynamicMenuItem( $doubleList, "ObjectIndex", 4 );
  3060.         PIeditDynamicMenuItem( $doubleList, "RotationType", 4 );
  3061.         PIeditDynamicMenuItem( $vectorList, "Rotation", 9 );
  3062.         PIeditDynamicMenuItem( $vectorList, "AimDirection", 9 );
  3063.         PIeditDynamicMenuItem( $vectorList, "AimPosition", 9 );
  3064.         PIeditDynamicMenuItem( $vectorList, "AimAxis", 9 );
  3065.         PIeditDynamicMenuItem( $vectorList, "AimUpAxis", 9 );
  3066.         PIeditDynamicMenuItem( $vectorList, "AimWorldUp", 9 );
  3067.         PIeditDynamicMenuItem( $doubleList, "CycleStartObject", 4 );
  3068.         PIeditDynamicMenuItem( $doubleList, "Age", 4 );
  3069.     }
  3070. }
  3071.  
  3072.  
  3073. global proc PIupdateDynamicAttributeOptionVar( string $name )
  3074. {
  3075.     string $omName = $name + "OM";
  3076.  
  3077.     if ( `optionMenuGrp -q -exists $omName` == 1 )
  3078.     {
  3079.         optionVar -stringValue $omName `optionMenuGrp -q -v $omName`;
  3080.     }
  3081. }
  3082.  
  3083.  
  3084.  
  3085. global proc PIcreateSelectedObjectList() 
  3086. {
  3087.     int    $i;
  3088.     string $transformList[] = `ls -typ transform`;
  3089.     
  3090.     for ( $i = 0; $i < size( $transformList ); $i++ )
  3091.     {
  3092.         textScrollList -e -a $transformList[$i] PIselectObjectList;
  3093.     }
  3094. }
  3095.  
  3096.  
  3097. global proc PIparticleOptionChanged( string $parent ) 
  3098. {
  3099.     setParent $parent;
  3100.     string    $particleList[] = `ls -typ particle`;
  3101.  
  3102.     // We only want to create the dynamic attribute list if we have 
  3103.     // a valid particle shape.
  3104.     //
  3105.     if ( size( $particleList ) > 0 )
  3106.     {
  3107.         PIeditDynamicAttrOptionMenus();
  3108.     }
  3109.  
  3110.     // Update the values of the selected menu item.  We need to do this
  3111.     // because the indices may have changed if the number of attributes
  3112.     // is not the same for each particle shape.
  3113.     //
  3114.     setAllDynamicAttributeOptionMenuGrp();
  3115. }
  3116.  
  3117.  
  3118. global proc __INST_OBJ_LIST_setItemList( string $list[] )
  3119. {
  3120.     global string $__INST_OBJ_LIST_items[];
  3121.     $__INST_OBJ_LIST_items = $list;
  3122.     __INST_OBJ_LIST_fillItemList();
  3123. }
  3124.  
  3125. global proc __INST_OBJ_LIST_removeSelectedItems()
  3126. {
  3127.     global string $__INST_OBJ_LIST_items[];
  3128.  
  3129.     int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`;
  3130.     if( size($selectedIndices) == 0 )
  3131.         return;
  3132.  
  3133.     int $i;
  3134.     int $j;
  3135.     string $temp[];
  3136.     for( $i = 0; $i < size($__INST_OBJ_LIST_items); $i ++ )
  3137.     {
  3138.         int $found = 0;
  3139.         for( $j = 0; $j < size($selectedIndices); $j ++ )
  3140.         {
  3141.             if( $selectedIndices[$j] == $i+1 )
  3142.                 $found = 1;
  3143.         }
  3144.  
  3145.         if( $found == 0 )
  3146.         {
  3147.             $temp[size($temp)] = $__INST_OBJ_LIST_items[$i];
  3148.         }
  3149.     }
  3150.     $__INST_OBJ_LIST_items = $temp;
  3151.  
  3152.     __INST_OBJ_LIST_fillItemList();
  3153. }
  3154.  
  3155. global proc __INST_OBJ_LIST_moveSelectedItemsUp()
  3156. {
  3157.     global string $__INST_OBJ_LIST_items[];
  3158.     int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`;
  3159.     if( size($selectedIndices) == 0 )
  3160.         return;
  3161.  
  3162.     int $newSelectedIndices[] = $selectedIndices;
  3163.  
  3164.     int $i;
  3165.     for( $i = 0; $i < size($selectedIndices); $i ++ )
  3166.     {
  3167.         int $si = $selectedIndices[$i] - 1;
  3168.         if( $si > $i )
  3169.         {
  3170.             string $temp = $__INST_OBJ_LIST_items[$si];
  3171.             $__INST_OBJ_LIST_items[$si] = $__INST_OBJ_LIST_items[$si-1];
  3172.             $__INST_OBJ_LIST_items[$si-1] = $temp;
  3173.             $newSelectedIndices[$i] = $si;
  3174.         }
  3175.     }
  3176.  
  3177.     __INST_OBJ_LIST_fillItemList();
  3178.     for( $i = 0; $i < size($newSelectedIndices); $i ++ )
  3179.     {
  3180.         textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList;
  3181.     }
  3182.  
  3183.     int $firstSelected = $newSelectedIndices[0];
  3184.     if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` )
  3185.     {
  3186.         int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1;
  3187.         textScrollList -e -showIndexedItem $selectThis  PIselectObjectList;
  3188.     }
  3189. }
  3190.  
  3191.  
  3192. global proc __INST_OBJ_LIST_moveSelectedItemsDown()
  3193. {
  3194.     global string $__INST_OBJ_LIST_items[];
  3195.     int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`;
  3196.     if( size($selectedIndices) == 0 )
  3197.         return;
  3198.  
  3199.     int $newSelectedIndices[] = $selectedIndices;
  3200.  
  3201.     int $i;
  3202.     for( $i = size($selectedIndices) - 1; $i >= 0 ; $i -- )
  3203.     {
  3204.         int $si = $selectedIndices[$i] - 1;
  3205.         int $ni = size($__INST_OBJ_LIST_items) - ( size($selectedIndices) - $i );
  3206.         if( $si < $ni )
  3207.         {
  3208.             string $temp = $__INST_OBJ_LIST_items[$si];
  3209.             $__INST_OBJ_LIST_items[$si] = $__INST_OBJ_LIST_items[$si+1];
  3210.             $__INST_OBJ_LIST_items[$si+1] = $temp;
  3211.             $newSelectedIndices[$i] = $si+2;
  3212.         }
  3213.     }
  3214.  
  3215.     __INST_OBJ_LIST_fillItemList();
  3216.     for( $i = 0; $i < size($newSelectedIndices); $i ++ )
  3217.     {
  3218.         textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList;
  3219.     }
  3220.  
  3221.     int $firstSelected = $newSelectedIndices[size($newSelectedIndices)-1];
  3222.     if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` )
  3223.     {
  3224.         int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1;
  3225.         textScrollList -e -showIndexedItem $selectThis PIselectObjectList;
  3226.     }
  3227. }
  3228.  
  3229.  
  3230.